Banner

Banner
Ramast
Linux Developer

Monday, May 20, 2019

How to obtain indonesian visa from Egypt

I am Egyptian who went to their embassy approximately 7 times to get Indonesian visa. This guide is meant to help you cut that time to just two visits.

Do I need visa at all?


Probably not.

If you intend to spend less than 30 days you can just fly to Indonesia and get in without any visa. Just make sure you bring with you return (or on-ward) flight ticket and hotel reservation.

If you want to stay these for more than 30 days, you can still obtain visa on arrival that gives you 30 days but can be extended in indonesia for another 30 days (total of 60 days).

If you are to apply for a visa in the embassy however, you get 60 days directly. Not 100% sure if you can extend it beyond that.

Where do I apply for the visa?


I will tell you where NOT to apply. In Indonesia's official consulate near Tahrir square. There is another smaller consulate in Nasr City that issue visas.

 

The flag is where a famous nearby school "Al Manhal Private School" is located. There is a swvl bus stop there.

What papers do I need to bring with me?



1. Your passport
2. HR letter (IN ENGLISH)
3. Return or onward flight ticket
4. Bank Statement that with at least 1000 dollar balance.
5. Hotel booking
6. 50 US Dollars (Egyptian pound won't be accepted)
7. If you are not Egyptian, you might need more papers. I don't know.

How do I avoid going many times?


1. Make sure you don't go in a day that is public holiday for Indonesia or Egypt
2. Go early (embassy opens at 10:30)

Once there get application form and fill it. If all your papers are accepted then you will have to go to a CIB bank and pay there then bring payment receipt back to the embassy.

There is a CIB branch on the same street of the embassy but it's a bit long walking distance. Can take any bus going west and ask to drop you at CIB bank.

Once you have made the payment, you back to the embassy, provide all the papers and the payment receipt and leave your passport. You should be able to pick your passport within 3-4 days. For passport pickup you should come late (1:30 to 3pm).

I applied for my visa during Ramadan. During normal months the time might change slightly so better ask there when to pickup your passport



Enjoy Indonesia.








Thursday, January 31, 2019

How to unbrick your kindle paperwhite? (For Linux Users)

The process of unbricking itself, is covered here and I will assume you have already read that link before you continue reading this article.

There you had two options, either flashing system image yourself or downloading an amazon official update and installing that instead.

But sometimes that's not good enough. What if you have already made changed to the system that you want to maintain? What if you already know what is the problem and just need to access the system and correct the mistake?

For that there is a Recovery mode where you can have shell prompt and can modify the existing system as u wish.

You get there by booting into diagnostics mode, then from the options to login to recovery mode however you must provide username/password.

username is always root but finding the password can be a bit tricky since it's NOT same as your main system's password.
For me password was "mario" but if that didn't work for you then you will need to find your device serial number and generate password using this guide or this.

Once you are logged in, your system partition is the first partition /dev/mmcblk0p1 you can mount it and modify it as you please. Your data partition would be already mounted for you in /mnt/us

After you finish make sure you disable diags mode so that when you reboot you are rebooted to main system.

How NOT to install custom fonts on your kindle paperwhite.

This article is meant for people who have rooted Kindle and have good understanding of Linux command line. I explain here how I tried to manually - without use of any scripts - install custom fonts to my kindle, How I bricked it twice because of this and how I got it working at last.

If you are just looking for installing custom fonts, please refer to this post instead.

Attempt 1


I've tried to locate the directory where kindle store it's fonts and tried to add my custom font there.

The main and most important font directory is located in /usr/java/lib/fonts/ however that directory is mounted readonly and can NOT be mounted in read-write mode - for reasons I will explain later -.

There was however other directories that contained fonts and even though I could add my font there, I later realized that it's very difficult to make amazon use my custom font. It's there, it's installed but you can't select it when reading a book.

Attempt 2

My only option was to replace one of the fonts the reader allow u choose from (Baskerville, Caecilia, Futura, Helvetica and Palatino). The two in red are used by the system (especially Futura) so I chose another one.
Only problem is that they are located in the read only directory  /usr/java/lib/fonts/.

Why is it read only?
The directory is just a mount point, the fonts are actually stored in a disk image   /usr/java/lib/fonts/fonts.cramfs.img That disk image uses readonly file system called cramfs. It's a read only filesystem, once it's been created it can never be modified again

The good news however is that the tools needed to create such filesystem are already bundled in your kindle so the idea is to copy over the fonts to a directory of your choice, modify it as you desire, use the tools bundled with kindle to convert it back to cramfs and replace the original one with your version.

mkdir /mnt/base-us/fonts
cd /mnt/base-us/fonts
cp /usr/java/lib/fonts/* .

# <<Modify fonts as desired at this point>>
# Regenerate fonts special files to accommodate your changes.

mkfontscale
mkfontdir
# Generate new cramfs filesystem
cd ..
mkcramfs fonts/ fonts.cramfs.img
# Backup original file
cp /usr/java/lib/fonts.cramfs.img fonts.cramfs.img.backup
# Replace original file with your file
mntroot rw
cp fonts.cramfs.img /usr/java/lib/

After you run this code you will get an error about not enough disk space and as soon as you reboot, you will find that your device is BRICKED.
I repeat, following the code above will almost certainly BRICK your device, don't try it until you read rest of the article.

Why this bricked my device?
When you try to replace one file with another, what actually happen is that the original file is deleted first then the second file is copied in the same place.

But what if the original file is in use by another program? In Windows you would get an error and the operation will fail but in Linux (and Unix), It will mark the original file as deleted - while still preserving it on disk - and put your file in place. When the program(s) using the original file are closed then the system can truly delete the original file and free the disk space it's occupying.

In this case original fonts.cramfs.img file was obviously being used by the system so deleting it didn't release the space it's occupying. Unfortunately for me, the remaining disk space was much smaller than my custom fonts.cramfs.img so when I tried to replaced the original I got disk space error and ended up with partial fonts.cramfs.img file. When I restarted kindle, it tried to mount my custom file and it failed so the system didn't load at all. [ bricked ]

Attempt 3


I will not go in details here on how I unbricked my kindle, I will put that in a separate article but for the most part I followed this amazing guide

My next idea was to write a script that restart kindle UI and before it get chance to start again I unmount the original fonts disk image and mount mine instead. That way the original would not be in use and when I delete it, the system should free it's disk space.

This was my code

pkill blanket
while ! umount /usr/java/lib/fonts
do 
  true # Do nothing
done
mount -oloop /mnt/us/fonts.cramfs.img /usr/java/lib/fonts/

Even though I succeeded in unmounting the original fonts image file, for some reasons system still didn't free the space it's occupying when I deleted it.
I ended up bricking my device once more.

Attempt 4


By that time I became an expert at unbricking my kindle and wasn't afraid to play around so I went back to my custom fonts, I deleted many chinese and korean fonts, regenerated my custom image using the code mentioned above and replaced original while in recovery mode and now I have extra free disk space and also my custom font. Yaay

My final advice

Modifying fonts file will always pose risk of bricking your device so don't do it if you can't deal with bricked kindle.
If you are willing to take that risk however, I advice you to make sure there is more disk space in your root directory than the size of your custom fonts image BEFORE replacing the original.

If you found yourself in situation where the original has been deleted but you don't have enough disk space to copy your own, create a custom font image that ONLY contain the fonts Futura, Helvetica then copy that image instead of corrupted one. This solution has not been tested however so it may or may not work but it's certainly better than rebooting with a corrupted fonts image.

Happy Hacking

Thursday, November 8, 2018

How I compiled FreeCAD in Gentoo (2018 Guide) [ updated 2020 ]

Compiling FreeCAD on gentoo


Introduction:

While you could download FreeCad binary that would work out of the box with 0 hassle, it was slow and not very stable (lot of segmentation errors on my gentoo machine.

There used to be gentoo ebuild for freecad but I couldn't find it during the time of writing this.

I've documented the steps I followed to compile FreeCAD and I am posting it here in case someone finds it useful.

Please note that while compiling from source reduced crashes and increased speed a lot, it didn't help with importing SVG problem (still gives segmentation error).

Download FreeCAD source code

Emerge required packages


echo "sci-libs/vtk X imaging qt5 boost tbb rendering" > /etc/portage/package.use/vtk
echo "dev-libs/xerces-c iconv icu" > "/etc/portage/package.use/xerces-c"

emerge xerces-c

emerge libmed

# Ensure it's version 3 with -static-libs (disable static-libs)
media-libs/coin

# Adding qt repo overlay using layman
emerge app-portage/layman
layman -a qt
layman -E qt



# If u started getting errors related to boost while compiling FreeCAD, consider re-emerge boost
emerge -1 boost


# If getting error
No rule to make target '/usr/lib64/libmedC.so', consider re-emerge libmed


Installing Opencascade

You can either emerge opencascade

emerge libopencascade (+tbb +vtk)

or build it yourself.
At time of writing the available version in portage is 6.9.1-r2 which caused some crashes in FreeCAD
If you couldn't find newer build, It's better that you compile it and install it yourself.

wget 'https://www.opencascade.com/system/files/occt/OCC_7.3.0_release/opencascade-7.3.0.tgz'
(extract and cd into the package)
cmake -DUSE_VTK=1 -DCMAKE_BUILD_TYPE=Release .
make
make install


Finally compile FreeCAD

cmake -DFREECAD_USE_EXTERNAL_PIVY=ON -DCMAKE_BUILD_TYPE=Release  -DBUILD_QT5=ON -DPYTHON_EXECUTABLE=/usr/bin/python3 $PWD
cmake --build .



Run it directly first to ensure it's working by executing:
./bin/FreeCAD

You can then install it after
make install

Optional, install openscad for extra FreeCAD features

emerge openscad

Thursday, October 5, 2017

Booting Linux on a 10 years old laptop using usb stick

I have an old Acer laptop (10 years old) which no longer has a functional hard disk.
So the only way to boot was using a usb stick which my laptop presumably support.
I tried to boot some Linux installed on a usbstick but isolinux bootloader would just report that there was a problem and refuse to boot.
I tried putting linux distro that support grub bootloader but again, grub gave this error: grub - error out of partition

After lot of frustration I found that the problem was that my flash memory was simply too big (7GB) and my 10 years old laptop's BIOS is not ready to deal with such massive size memory stick.


Solution?

I've created a smaller partition table and placed it on my usb stick to make it look like it's only 2GB memory stick. That surprisingly solved the problem and my laptop booted just fine.

Here is how I did it (under Linux/Unix)

First I created a 2GB empty file

fallocate -l 2G disk.img

If that didn't work, try
dd if=/dev/null of=disk.img bs=4k count=512k

Now you have a 2GB empty file, let's associate that with a loop device

losetup loop3 disk.img

So far so good, now let's create new file system on the disk.img file

fdisk /dev/loop3

Command (m for help): n
Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p):  <press enter and keep pressing enter until you return to the prompet>
Command (m for help): w

Final step, write the new partition table to the usb stick

dd if=disk.img of=/dev/<your usb stick dev>
(Note that would result your usb stick appear to have only 2GB capacity but this is not permanent and can be easily reverted back later)

Done, you are now ready to install whatever usb stick linux dsitro (like dsl, sysrescuecd or any other on your laptop)

Monday, April 6, 2015

Adventure in a Balinese cemetery


I was staying with my friend in a nice hotel in Ubud (Bali)
People working in the hotel were very friendly and very eager to talk about their culture and religion.
We discussed Hinduism, the offerings, the festivals, .... and I asked if any festivals would happen soon.
She said there are so many minor festivals and for example there is a one after two days called Magic festival.
Magic? hmm, that's interesting. What kind of magic do you practice?
She said no magic, but there is that evil creature the source of envy and hate - a devil? -
who would appear that day and some special (gifted?) people could see it.
We pray that day not to see that creature. I asked if she ever saw it, she said no and she doesn't want to.

Hmmm, so what do I do if I want to see it? they start to laugh and explain that not everyone can see it.
One of them pop out her smartphone and show me a video of a claimed appearance which to me looked like a guy wearing a mask in dark night.
I repeated the question, Assuming I could see it what should I do to see? She said: you have to go a cemetery.
What time? I asked as if I am asking her for a date. She was dead serious when she said after 12 mid night the night before.
Wanna come with me? No, she said "I scare"
The next day (day before the festival) I meet another local man who has a shop with his wife.
I told him about my intentions and he asked me who told you about that? I thought he would deny the whole thing.
Instead he confirmed it. Even though he has been to that cemetery a lot he wasn't shy to say "he scare" when I asked if he wants to come.
Whatever, now I want to go even more.

Clock ticks 10:30pm I start limping to the cemetery - a motorbike fell on my foot few days earlier.
I wasn't worried the demon would out run me, they always do. I was more concerned about the cemetery guards.
I was being told if I run inside the cemetery they wouldn't dare to follow me inside so it was quiet relieving except that I can't run.

I really wanted someone with me. Partially because I also "scare" but also because if the demon didn't come at least I'd have nice company.
There was a dormitory near my hotel. I thought about it many times before.
I can't just approach group of strangers and ask if they would like to join me to a cemetery at midnight so I didn't dare to ask there.
I continued walking past the dorm until I got close enough then I had to ask for directions.

First guy  (Western) told me there is no cemetery in that area and he didn't seem he want to discuss it further.
Two Singaporean guys I asked after were more curious and asked me why I want to go and they said its a very bad luck in their culture to see a ghost (Its a demon for Christ's sake not a ghost).
Well guys, Wish me horrible luck. (I should've said but, I didn't)
Eventually I got near the entrance. The cemetery didn't even have a door, no guards, no nothing.
Only some fire flies making dots of yellow light that soon vanish leaving the area in complete darkness except for quarterly lit moon

As I approached the entrance I was surprised to see two other guys with clear American accent coming out.
I was excited and asked them if they also heard about the magic festival. They said they had no clue. They came to see the fire flies. They didn't even know it was a cemetery.

I explained to them my intentions, they argued that this can't be a cemetery because Hindu burn their dead.
I explained what the hotel lady told me about dead people having to wait for up to 10 months before they can get a proper cremation.
If the family is poor or doesn't want to wait they burn the dead body in a big oven. some people are not burned at all.

They were spiritual (in some sense). One of them seemed to be the leader/teacher/more experienced while the other was more like enthused follower.
So that leader guy - will call him Bob - agreed to join with his friend and we started to explore the cemetery with flashlight.
In the meanwhile they were talking about the sequence of coincidences that led us to me and how they came for something simple like watching butterflies only to find themselves in the right place at the right time to witness this.

They refused to call it coincidences and that there was that magician who told them things that they can not reveal to me and other things that happened to them earlier that they also can not tell.

I was like: hmfff whatever, still their company is better than staying in a cemetery alone.

Lot of insects, lizards and frogs and tree leaves falling all make sounds which is not very comfortable at this point.
We sit on the floor near the enterance talking and waiting for something to happen.
Bob stated to collect rocks and make a circle to "protect" us.
It started to get creepy when they told me about their true intentions at this point.
They were not looking for fireflies, they practice some religion where they worship co..ehm..x (yes, you heard that right, move on)

Suddenly I started to scare. They are not too strong but they are two!
In a cemetery at 12am there isn't much I can do if they decided to worship mine.
I shook off that idea. People have the right to believe what they want or worship what they want .. you know so long as they do it away from me and my thing.

Bob says they kind of worship that demon as well which he says is not as bad as the media depict it (ooh, bloody media they ruin everyone's reputation)
and yet he wasn't very thrilled to meet it either. How come you don't want to meet with the god you worship? He agreed that in some sense I am right.
[I should work as a demon preacher, I guess]

Time passes and aside from the small movements of lizards and insects and light of fire flies, nothing seem to be happening.
Bob suggest that if I want to see it, probably I should get out of the "protection" circle which I eagerly did with a big smile on my face.
Where do I sit? here? (Its more fun when you have people to tease)

Few more minutes and nothing much has changed. Although to be honest I felt safer inside the circle.
Bob starts to make his prayers and ask us - me and the other guy - to be silent for a while and we complied.
We started talking again after getting bored. Eventually Bob said you know? That demon is in the tombstone downstairs.

There was a very big distinctive tombstone that we saw earlier that stand alone in a lower ground (reachable by two stairs at both sides of the cemetery).
I started to scare again! both from the demon and from the two guys who might have an evil plan for me when I come back or at best a silly prank.

I suggested a bet if I go there and I find nothing but he refused to bet. Alright thats relieving that means he isn't very confident about that demon's presence.
I also refuse going down stairs without compromising my dignity since he refused the bet which is exactly what I did.
More time passes and I am bored as hell now. alright whatever, I will go down there. A prank would be more interesting that that boring silence.
I turn my mobile flash on and move toward the end of the cemetery, look from the top at the big tombstone below. hmmm no demons, good.
I go back and tell him that but he insist that I must go downstairs and see for myself.

I am suspicious but I almost won (proving my point that such thing doesn't exist) and I can not turn back now.
I went downstairs, more worried this time than ever since I arrived. While those Bas...rds sitting happily in their protection circle.

With each step I hear many sounds which I assume are lizards and insects running away from me.

I found a lovely colorful warm on a plant. I stopped to take a picture of it, flash turn on and ...

chik, got a nice shot. nobody downstairs except for the dead king under that big tombstone.  I went back and as I feared they vanished. What were they planning to do all that time? I am about to find out.
I get closer to the entrance and .. oh, there they are. Sitting happily in their stupid circle waiting for me.
I took a deep breath and released it with a sight of relief.

Bob eventually gave up and said maybe better they leave so that I can have alone time with the demon. I told him he is probably not coming tonight.
We went back to our hotels. couple of drunk girls passed by on a scooter waving for us.
I said: Hey take us ... oh no, take me those guys don't care.
I saw a sign of disappointment on Bob's face. Sorry dude.
We separated each to his hotel short after.

The END.
This story has happened for real with no exaggeration or any added details.

Sunday, December 22, 2013

Websites that will educate you for free

I found this list of links posted by a redditor called Fletch71011 
The original post can be found here

Now here is the list:

No Excuse List - Includes sources for everything you can want. I included some more popular ones with brief write-ups below. Credit to /u/lix2333.

Reddit Resources - Reddit's List of the best online education sources

Khan Academy - Educational organization and a website created by Bangladeshi-American educator Salman Khan, a graduate of MIT and Harvard Business School. The website supplies a free online collection of micro lectures stored on YouTube teaching mathematics, history, healthcare and medicine, finance, physics, chemistry, biology, astronomy, economics, cosmology, organic chemistry, American civics, art history, macroeconomics, microeconomics, and computer science.

Ted Talks - Talks that address a wide range of topics ("ideas worth spreading") within the research and practice of science and culture, often through storytelling. Many famous academics have given talks, and they are usually short and easy to digest.

Coursera - Coursera partners with various universities and makes a few of their courses available online free for a large audience. Founded by computer science professors, so again a heavy CS emphasis.

Wolfram Alpha - Online service that answers factual queries directly by computing the answer from structured data, rather than providing a list of documents or web pages that might contain the answer as a search engine might. Unbelievable what this thing can compute; you can ask it near anything and find an answer.

Udacity - Outgrowth of free computer science classes offered in 2011 through Stanford University. Plans to offer more, but concentrated on computer science for now.

MIT OpenCourseWare - Initiative of the Massachusetts Institute of Technology to put all of the educational materials from its undergraduate- and graduate-level courses online, partly free and openly available to anyone, anywhere.

Open Yale Courses - Provides free and open access to a selection of introductory courses taught by distinguished teachers and scholars at Yale University.

Codecademy - Online interactive platform that offers free coding classes in programming languages like Python, JavaScript, and Ruby, as well as markup languages including HTML and CSS. Gives your points and "level ups" like a video game, which is why I enjoyed doing classes here. Not lecture-oriented either; usually just jump right into coding, which works best for those that have trouble paying attention.

Team Treehouse - Alternative to Codecademy which has video tutorials. EDIT: Been brought to my attention that Team Treehouse is not free, but I included it due to many comments. Nick Pettit, teaching team lead at Treehouse, created a 50% off discount code for redditors. Simply use 'REDDIT50'. Karma goes to Mr. Pettit if you enjoyed or used this.

Think Tutorial - Database of simple, easy to follow tutorials covering all aspects of popular computing. Includes lots of easier, basic tasks for your every day questions or new users.

Duolingo - For all of your language learning needs.

Memrise - Online learning tool that uses flashcards augmented with mnemonics—partly gathered through crowdsourcing—and the spacing effect to boost the speed and ease of learning. Several languages available to learn.

Livemocha - Commercial online language learning community boasting 12 million members which provides instructional materials in 38 languages and a platform for speakers to interact with and help each other learn new languages.

edX - Massive open online course platform founded by Massachusetts Institute of Technology and Harvard University to offer online university-level courses in a wide range of disciplines to a worldwide audience at no charge. Many other universities now take part in it, including Cal Berkeley. Differs from most of these by including "due dates" with assignments and grades.

Education portal - Free courses which allow you to pass exams to earn real college credit.

uReddit - Made by Redditors for other Redditors. Tons of different topics, varying from things like science and art to Starcraft strategy.

iTunes U - Podcasts from a variety of places including universities and colleges on various subjects.

Stack Exchange - Group of question and answer websites on topics in many different fields, each website covering a specific topic, where questions, answers, and users are subject to a reputation award process. Stack Overflow is used for programming, probably their most famous topic. Self-moderated with reputation similar to Reddit.

Wikipedia - Collaboratively edited, multilingual, free Internet encyclopedia. Much better source than most people give it credit for, and great for random learning whenever you need it. For those looking for more legit sources for papers and such, it is usually easy to jump to a Wikipedia page and grab some sources at the bottom.