Earlier this year, we had a very fun filled Harry Potter themed gender reveal party. For the reveal, I built a Magic Cauldron which would reveal the gender. Check it out for yourself!
For this I needed:
A Cauldron.
WS2812B LED array.
Aurdino UNO.
Bread board and jumper wires.
Dry ice.
Kasa Smart bulbs
I will go over in the following sections
The Mist.
In this post, I want to share about "Kakashi: The Copycat Robot"—a fun side project I built a few years ago. The name is inspired by the famous character from Naruto, Kakashi Hatake, also known as the Copycat Ninja.The goal of this robot was to mimic Kakashi's ability to copy movements—though, of course, in a more limited way. Check it out for yourself!Here are the things I used to build this:
Just as we saw a huge influx of images in the past decade or so, we are now seeing a lot of videos being produced on social media. The need to understand and moderate videos using machine learning has never been greater.
In this post, I will show you how to build an efficient pipeline to processes videos in Tensorflow. For simplicity, let us consider a Resnet50 model pre-trained on
When I was a kid, I really loved solving Where's Waldo. There were few books (it used to be called Where's Wally) in our school library on which I spent hours finding Waldo. For people who do not know what it is, basically Waldo - a unique character is hidden among hundreds of other characters and you have to find him in all the chaos in the image.
Now that I am too old to be solving it and
I have been meddling with google's deeplearn.js lately for fun. It is surprisingly good given how new the project is and it seems to have a sold roadmap. However it still lacks something like tf.layers and tf.contrib.layers which have many higher level functions that has made using tensorflow so easy. It looks like they will be added to Graphlayers in future but their priorities as of now is to
I installed unofficial CM 12 with Android 5.0.2 today. Earlier I was using stock Android Lollipop and it had the option of adding Microsoft Exchange account. Unfortunately CM12 didn't seem to have it.
After doing some research I figured out that only devices running stock Android 5.0+ are capable of having exchange accounts. And CM12 although runs on Android 5.0, doesn't have this feature. On doing further research I found out that Android 5.0+ have something called Exchange services which enables gmail 5.0 to handle exchange accounts.
I was playing around with framework-res.apk and SystemUI.apk to get Ambient Display on my Nexus 4. When I restarted my phone, it seemed to have stuck in a bootloop. I knew that factory reset might've worked. But I didn't want to lose any data.
Fortunately adb was working. When I did adb logcat , it was logging an error saying: /system/framework/framework-res.apk is neither a file nor a folder (type=0)
I realized that there was some problem with permissions of that file. I used adb shell and changed the permission of framework-res.apk and SystemUI.apk to 0644. But this was of no use. However I came to know that if I could somehow reset /system partition the problem would be solved.
So I downloaded the factory image of my phone. For nexus devices it is available here.
Extract the contents of the image-xxxx-xxxx.zipto get the file system.img.
Then ran the following: adb reboot bootloader fastboot flash system system.img
This will wipe the /system partition and reset it without touching any other partitions. Hence you will not lose any data.
Restart. It took a while to start the phone completely. But it solved the problem!
This is how I was able to reset my framework-res.apk and SystemUI.apk!
I love languages which aren't strongly typed. It makes software development process very fast and very easy as we need not write huge, complex, unreadable code like in our typed languages. However this can lead to developer's worst nightmare: Runtime errors! In languages such as javascript it is not easy to check for type mismatches while in development process. Hence flow was invented!
Flow is one of Facebook's open source projects. It allows developers to check for programming errors in javascript code with very less effort. This is a sample code available on their site:
functionfoo(x){returnx*10;}foo('Hello, world!');
Note that a string is passed into the function foo and an arithmetic operation is performed on that string inside it. When flow is run on this code:
01_HelloWorld/hello.js:7:5,17: string
This type is incompatible with
01_HelloWorld/hello.js:4:10,13: number
It points out that the string is incompatible with number. Consider a much much complex code. An error like this can simply be unnoticed until a runtime error is raised.
This can happen on any phone with soft navigation keys.
Yesterday, I was tweaking my Nexus 4 after updating to Lollipop. When I restarted my phone I found that the Navigation Bar had disappeared! Even to switch from one app to another I had to restart my phone! Then I found a way to fix it.
Install Root explorer or ES Explorer. Open it and go to /system and mount it in R/W.
Then open the file build.prop in the current folder using text editor.
Then go to bottom of the file and change the value of "qemu.hw.mainkeys" from 1 to 0
It is not possible by default to mount a NTFS External Drive in write mode on OS X since Mavericks. There is a complex way to do this. In order to make it simple for you, I wrote a script which does it.
First you need to install Xcode and Homebrew. Google how to install them :P
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Now connect the drive. In Mavericks you will get a warning “Kernel extension is not from an identified developer”. You are good to go if you click OK. However, if you are using Yosemite, you have to restart your system to load the kernel extension. For more on that read this.
In Yosemite you might get the following error if you are updating old osxfuse. As we have enabled developer mode which allows you to run unsigned kext, it will not be a problem.
osxfuse: OS X Mavericks or older is required for this package.
OS X Yosemite introduced a strict unsigned kext ban which breaks this package.You should remove this package from your system and attempt to find upstream binaries to use instead.
Uninstalling
Execute the following command to replace the modified NTFS mounter with the original one
Since Mavericks, OS X started checking signatures of kernel extensions. However unlike in Mavericks, loading unsigned code to kernel is disabled in Yosemite (in Mavericks only a warning, “Kernel extension is not from an identified developer” was displayed). It is required to sign kernel extensions using the Developer ID obtained after enrolling in Mac Developer program. With Yosemite still in beta, it is hard to find signed kernel extensions other than the ones officially released by Apple.
You will get this error when you try to load unsigned kext:
Diagnostics for [unsigned kext]:
Code Signing Failure: not code signed
ERROR: invalid signature for [unsigned kext], will not load
This being said, it is possible to sign all unsigned kext by doing this:
You might've observed that some third party apps have blurry windows on mac. This is due to the fact that those apps are not making use of the retina display introduced by Apple sometime back. I found a simple way to fix this using an app called Retinizer. Simply drag and drop the app (.app file from Applications folder) to its window to "Retinize" the app!
Deleting .nomedia file not enough to make a folder visible in androidgallery
TL;DR: After removing .nomedia file, add/delete some file in that folder.
You might probably know that if you want to hide a folder from gallery all you have to do is create an empty file called .nomedia. This will make sure that the media scanner will skip that folder.
Sometime back I did this when I wanted to hide the Whatsapp folder from gallery. Now I changed my mind and want Whatsapp folder to show up in the gallery. So I did like any other guy would do -- I deleted .nomedia file from that folder. But this didn't work.
If I had any android version prior to Kitkat, I could've just run media scanner from some app. Unfortunately after Kitkat this wouldn't work (They changed how media scanner works to save battery).
Then I tried renaming the folder (after deleting .nomedia file). Magically, all the images started displaying in the gallery. However, I couldn't afford changing the name of the folder.
I realized that post jellybean, media scanner updates the media index only when there is a change in the folder. So, I just added a new image to that folder manually. It worked like a charm!
NOTE: If the folder is on sdcard, you can just remove the sdcard and put it back (after removing .nomedia file) to run media scanner.
I switched to mac from ubuntu recently. I noticed that apps installed from .dmg files are not accessible from terminal. In ubuntu to open say, gvim (MacVim in mac) I used to simply type gvim in the terminal. This doesn't work on mac :(
After doing some analysis on how apps are maintained, I noticed that each application (.app) is stored in /Applications folder. And .app file is simply a directory holding contents of the app. Say I open firefox, the executable which launches the app (firefox), stored in /Applications/Firefox.app/Contents/MacOS is executed.
So if I execute: /Applications/Firefox.app/Contents/MacOS/firefox
from terminal, firefox is launched!
However I do not want to type this huge path every time I want to launch firefox nor do I want to alias each and every app I install nor do I want to add all of them to $PATH. So I wrote a simple script to automatically open any app I want to.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'Bigger than Heartbleed': Bash bug could leave IT systems in shellshock - CNET Shell Shock: Bash bug labelled largest ever to hit the internet - Sydney herald
You might have heard about "ShellShock" bug in bash shell that everyone is talking about. You might ask what is the big deal about it? and say that you don't even use bash. It might astound you if I say that this bug exists in so many systems from your fancy smart watches to android phones to Macbooks to powerful web/email/DHCP servers. Basically, bash shell is used everywhere! "Heatbleed" bug, a vulnerability in OpenSSL servers, created a huge fuss few months back. Experts think that ShellShock is much more serious than that considering the number of systems being affected. Lot of military and government organizations are at risk.
So what is Shell Shock?
It is a vulnerability present in bash till 4.3. Because of this lot of applications using bash are not safe. This 22 yr old bug exists because of the way bash handles environment variables. It is common to assign a function to an environment variable in shell scripts. However it was noticed that the trailing code in the function definition is also executed. Hence it is possible to remotely execute malicious code in many websites by just injecting it at the end of function definition.
To give more detail consider:
env X="() { pwd; ls;}; echo hacked"bash -c"echo done"
The result is: hacked done
After function definition, malicious code echo hacked was also executed!
There are three files in the folder: DO_NOT_DELETE_THIS.txt IMPORTANT.txt I_WILL_GET_FIRED_IF_I_LOSE_THIS_FILE.txt
after executing this all files get deleted!:
env X="() { :;}; rm -rf *"bash -c"echo completed"
Note that rm -rf * is injected (Here I have just typed :P) and it wipes the folder clean
How to fix this?
Considering the amount of legacy code which can't be modified, we need a patch in bash itself. Fortunately, a workaround is provided by RedHat here.
Sysadmins make sure that you apply this patch if you don't want to get fired :P
I was reading online sometime back and I came across this really interesting thing called 42.zip also known as Zip Bomb, Zip of Death, Peta bomb or decompression bomb.
The file is only 42,374 bytes (42KB). When unzipped it becomes 4,503,599,626,321,920 bytes (4.5 Peta Bytes)!!!
The main use of it is to render useless the host reading the file, usually to disable antivirus. When you unzip it, the antivirus will be busy scanning the unzipped files, sucking up all the available resources and a malicious program injected can execute itself undetected!
How it works?
42.zip has 16 zipped files.
Each of these 16 have 16 zipped files.
Each of these have 16 zipped files.
Each of these have 16 zipped files.
Each of these have 16 zipped files.
Each of these have 1 file, with the size 4.3GB
Still. How is this level of compression achieved??
It relies on repetition of identical files!! Think of it as same file being unzipped over and over again.
Awesome isn't it?!
We know that gvim -p can be used to open multiple files together in different tabs in gvim. However if you want to open a file in a new tab in the existing gvim session "gvim -p" wont do any good. For that we can use client server concept available in gvim. Add the following line in "~/.bashrc" file and you are good to go!
aliasgvim='gvim --servername gViM --remote-tab'
Now you can simply give gvim [file(s)] to open in new tab in the existing gvim session!
I got my first salary few days back. I could think of hundreds of ways to spend that money. But I wanted to do something else, something I've always wanted to do. I donated a tiny amount of my money to Wikipedia. I didn't stop there. I have contributed to open source earlier too, but only in the form of code. I felt that it is time for me to contribute monetarily. I made donations to Ubuntu foundation and Tor project. The amount of joy I got out of doing this was unfathomable and I am sure that nothing else would've made me more happy.
I have decided to spend a tiny percentage of my salary to donate for such organizations every month. I believe that donating as little as $2 each can shape a better and prosperous digital age. And I think people like me who are in their early 20s with absolutely no responsibility to bear should step up and do this too. Here is a list of organizations which could use your donations:
Wikimedia Foundation - Makers of Wikipedia and wikia. Providing free access to the sum of all human knowledge to every single person on the planet.
Ubuntu foundation - On a mission to make linux desktop reach the common man.
After Google announced that the new Material Design is going to be adopted on Android's next release, currently codenamed Android L; lot of us have wanted to try it. Unfortunately it (dev version) is available only for nexus 5 and 7. Thankfully there is Android L theme by tung91 on google play which brings near Android L experience to other users.
I feel that the default size of navigation bar is too huge and it occupies a lot of space on the screen. There is a simple way in which you can change the size of it if your phone is rooted.
Step1
Install Xposed Installer. Go to Framework and install neXus navbarz. Then select it and restart the device.
Step2
Open neXus navbarz. Go to navbar options and set navbar height! Restart the phone to see the change!
I installed CM11 on my Nexus 4. After I installed Google Calendar, I thought deleting stock AOSP calendar app and few other depending apps wont hurt. Unfortunately Google calendar sync stopped working after that. "Calendars to display" was empty and "Calendars to sync" never completed loading. When I searched for solution for this online, people suggested to do a reset; which I didn't want to do. So I tried reinstalling the default AOSP calendar app. It fixed the problem!!!
Download the following apks and install them on your phone.
Update
Some people say that they face the following error while signing in.
"Couldn't sign in. There was a problem communicating with Google servers. Try again later"
After installing the above apks, if you open the calendar app directly you will get this error. You have to restart the phone to fix it.
Unfortunately I am forced to use windows at work. So I installed cygwin to run linux commands. While editing using my favourite editor vim; I realized that backspace doesn't work at all! However I found out a simple way to fix it. Add the following line to .vimrc or .virc
set backspace=indent,eol,start
Now backspace magically works!
Later I found out that this is not just in cygwin and is pretty common in unix based systems.
shopt is a builtin command which can be used to customize the way you interact with terminal is several ways. Some of them are:
Ignore typos in path while changing directory
Say you want to go to /home/alse/path and you type /home/alse/paht instead, the following command will intelligently take you to /home/alse/path
shopt -s cdspell
Make commands case insensitive in linux
To be frank I like case sensitiveness of commands in linux unlike in windows command prompt. It makes you more careful while writing scripts. However I know some people who would like case in-sensitiveness.
It is possible to do this using shopt command.
shopt -s nocaseglob
Remove the need of 'cd' while changing directory
Tired of typing cd command before path? Try this
shopt -s autocd
Now you can simply type the path to go to that directory.
If set, and a file that Bash is checking for mail has been accessed since the last time it was checked, the message "The mail in mailfile has been read" is displayed.
shopt -s mailwarn
SIGHUP by default
Bash will send SIGHUP to all jobs when an interactive login shell exits.
It is hard to reuse multi-line commands as the newlines are replaced by semicolon and the many line command is converted to a single line. For example:
for i in $( ls *.txt) do pwd
echo $i
cp $i /bin
done
After executing it, when you press up button to reuse it, the command becomes:
for i in $( ls *.txt); do pwd; echo $i; cp $i /bin; done
Forget about reusing, I cant even understand what it does when so many things are stuffed in one line!
I found a way using which it is possible to retain the newlines in history using shopt.
shopt -s lithist
Now when you press up button you will see the command in multiple lines! win!
If you want this to be enabled by default add "shopt -s lithist" at the end of file ~/.bashrc
UPDATE
Also multi-line commands are screwed up when you add comments. For example
for i in $(ls) do echo "a" #echo $i done
becomes for i in $(ls); do echo "a" done (note that there is no semicolon after echo "a". Hence it takes echo "a" done as one command). Hence you will end up scratching your head to figure out what went wrong :P
We have seen cases where we are not allowed to safely remove or eject USB drive because of the fact that some process is using resources on the drive. The easy way to get out of this is to kill the process which is doing this. For example if the problem is the result of stalled file copying (say, using nautilus) thenkillall nautilus should do the trick. However it happens that sometimes it is not possible to figure out which process is accessing the USB drive. So how do we find the rogue process(es)?
fuser to the rescue!
fuser -k -15 -m /dev/sdb1
The above command will kill all the processes accessing your device! Replace /dev/sdb1 with the device file corresponding to your USB device.
Now try ejecting/ safely removing. It will mostly work!
Sometimes we might want to perform a 'dry-run' of package installations without actually installing them in order to prevent unwanted changes from happening. It is very much possible and is highly recommended specially while installing packages from untrusted sources. So do this before installing anything:
$ apt-get install --dry-run [package]
If you have a debian (.deb) package already and would like to see what changes it is going to make, do this:
$ dpkg --dry-run -i package.deb
This will definitely save you someday!
Mails used to be the easiest way to spread malware. So obviously Gmail doesn't allow users to attach windows executables (.exe) to mails in order to protect it's users from screwing up their windows machines. However, we may have to send .exe files which are not malware via mail. Before, you could've just renamed the extension from .exe to something else or made a zip/rar archive and gmail would simply allow you to attach it. Sadly, it doesn't work anymore as gmail started reading file headers of attachments and started reading files inside zip/rar archives.
So I figured out a simple way to do this using steganography. The idea here is to embed the exe file inside any image and attach it to the mail. Gmail will think that it is just an image and will be oblivious to the fact that there is an exe file hidden inside that. Later the other user can simply extract the exe file from the image and use it .
Usage
Download mailexe (Don't forget to make it executable).
Sending
$ ./mailexe -e [exe file] [image file]
A file called image.png will be created. This image file has exe file hidden in it. Send this via gmail.
Receiving
$ ./mailexe -d [original image] [duplicate image]
A file called output.exe will be created. This is exe file which had to be sent!!!!! Congrats!
How it works?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I always wanted an editor which can help me edit text securely with password protection using which I can easily create, save, edit files on fly. I am sure that there are some editors which can do it. However I felt that instead of an editor, it is better to have an interface which will allow me to edit files using my favorite editor while password protecting it. So I wrote a script called crypt-editor which uses gpg/mcrypt to encrypt and decrypt files enabling users to edit files using any editor.
You will be asked to enter the passphrase. Then gpg/mcrypt decrypts the file (if already exists) and opens it with gedit. On closing the file gpg/mcrypt encrypts it back and deletes the decrypted file.
If you do not specify the editor, the file is opened in vi editor (my favorite so it is default :P)
crypt-editor [filename]
Complete option list of crypt-editor:
crypt-editor -help
crypt-editor [filename]
crypt-editor [editor] [filename]
crypt-editor [-k key] [filename]
crypt-editor [-k key] [editor] [filename]
To create new file with mcrypt instead of gpg use -m option
crypt-editor -m [filename]
One of the main reasons why people turn into computer geeks is because they are lazy :P Yesterday was my birthday. Again, thanks for all the wishes :) However I was lazy to manually thank each and every post on my Facebook wall. So I wrote a simple python script using Facebook graph API to say thanks to each of them. I didn't stop there. I am aware that many people think that thanking people manually is something that has always been very tiring. So I searched for all the simpler alternatives available to do this task and found that there was a Facebook app called "Say Thank You". It is simple and neat. However, it requires people to give access to post, like, get friend list..etc. Well, that is a mini privacy invasion :P. So it is a not a good alternative. Also in future Facebook might think that it is doing something against their policies..blah blah blah and bring it down. So not a permanent solution either.
Hence I decided to rewrite the script I had written in python to javascript to make it accessible online. Well, here it is:
Click on Get Access Token if access token isn't there already.
Note that as this runs completely on the client side, users can safely use it without giving access to anybody (Although it requires you to give access token, it is not stored anywhere. See source ). And access tokens expire after sometime.
I updated to ubuntu 14.04 recently. I was very disappointed when I came to know that the awesome "tree view" was not available in nautilus. I searched online to find if there was any way to get it back. Most suggested to switch to older version of nautilus, which is simply absurd. So I decided to figure out a way myself and I did.
To switch to tree view first install dconf-editor. sudo apt-get install dconf-editor
Then open dconf-editor. Go to org -> gnome -> nautilus -> list-view and check use-tree-view.
Today I was running a c program which had to print lot of text on the terminal. However after some time it execution used to halt which seemed to be for no reason. This happens because whenever you write something to stdout, it stores it into a buffer till the process gets executed completely. To prevent buffering we can use unbuffer. This did the trick for me: unbuffer ./a.out
Whenever you redirect some command's output to a file, the output is first stored in buffer and then it s written to the file. Sometimes you may want to avoid this. Specially when the command is generating output continuously.