Skip to content

Instantly share code, notes, and snippets.

View ozooxo's full-sized avatar

Cong-Xin Cynthia Qiu ozooxo

View GitHub Profile
@ozooxo
ozooxo / gist:eac810bd39f5db8c4d1b
Created May 4, 2014 01:59
Combine two png graphs
montage -geometry 800x600+0+0 a.png b.png a+b.png
@ozooxo
ozooxo / gist:11186985
Created April 22, 2014 17:07
Allow non-root users to capture packets from Wireshark (ubuntu 14.04)
beta@landlubber:~$ sudo apt-get install wireshark
beta@landlubber:~$ sudo dpkg-reconfigure wireshark-common # choose yes
beta@landlubber:~$ sudo usermod -a -G wireshark beta
beta@landlubber:~$ sudo reboot
@ozooxo
ozooxo / gist:11166222
Created April 22, 2014 05:28
Manually put location data into Android Emulator
beta@landlubber:~/Software/Android/sdk/platform-tools$ ./adb devices
beta@landlubber:~/Software/Android/sdk/platform-tools$ ./adb -s emulator-5554 emu geo fix -93.24 44.98
@ozooxo
ozooxo / gist:11165806
Created April 22, 2014 05:00
Add i386 architecture in 64 bit ubunbu 14.04
# ./adb in Android Emulator doesn't work. It turns out that that executable file is 32 bit.
# beta@landlubber:~/Software/Android/sdk/platform-tools$ ./adb
# bash: ./adb: No such file or directory
# To install 32 bit architecture in a 64 bit ubunbu 14.04 machine, do
sudo dpkg --add-architecture i386
sudo apt-get -qqy update
sudo apt-get -qqy install libncurses5:i386 libstdc++6:i386 zlib1g:i386
./adb install ~/workspace/facebook-android-sdk-3.8.0/bin/FBAndroid-7.0.0.apk
# It works :-)
@ozooxo
ozooxo / gist:11165252
Created April 22, 2014 04:19
Android Emulator doesn't work (ubuntu 14.04 64bit)
# Error looks like "Failed to start emulator: Cannot run program "/home/beta/
# Software/Android/sdk//tools/emulator": error=2, No such file or directory".
# As people suggested, it works after
beta@landlubber:~/Software/Android/sdk/tools$ mv emulator emulator.bak
beta@landlubber:~/Software/Android/sdk/tools$ ln -s emulator64-arm emulator
@ozooxo
ozooxo / gist:10600945
Last active November 7, 2016 21:06
Set up honeyd (ubuntu 12.04)
# installation
sudo apt-get install honeyd
sudo apt-get install nmap #(supported software for port scanning)
# check my eth0 address
ifconfig
### eth0 Link encap:Ethernet HWaddr 00:26:2d:f9:db:be <-----------------use this one
### inet addr:192.168.0.103 Bcast:192.168.0.255 Mask:255.255.255.0
### inet6 addr: fe80::226:2dff:fef9:dbbe/64 Scope:Link
@ozooxo
ozooxo / gist:9959489
Last active September 29, 2017 17:08
clean up ubuntu disk space
sudo apt-get clean # cleaning up of the apt cache. it gives me roughly 500MB cache
sudo apt-get purge linux-image-3.5.0-37-generic # roughly 100MB per removed kernal. kernal list is in /boot/.
@ozooxo
ozooxo / gist:9927789
Last active August 29, 2015 13:58
Install gnome glib (ubuntu 12.04)
sudo apt-get install libglib2.0-dev
sudo apt-get install libgtk2.0-dev #optional
cat >hello.c <<EOL
#include <glib.h>
int main () {
return 0;
}
EOL
gcc `pkg-config --cflags glib-2.0` hello.c `pkg-config --libs glib-2.0` -o hello
@ozooxo
ozooxo / gist:9350235
Created March 4, 2014 16:46
Add matlab mime.types

My ubuntu just detects all .m files as Objective-C source code (text/x-objcsrc), so I'd like to add matlab mine.types to it. So I sudo gedit /etc/mime.types and add a line text/x-matlab m. If I want to automatically start matlab IDE, I should also add application/matlab m.

However, it seems not working at least in Ubuntu 12.04.

@ozooxo
ozooxo / gist:9280304
Last active May 15, 2019 19:47
MPI always gives rank=0, size = 1

I accidentally installed multiple versions of MPI's (openmpi, mpich2, ...) in my Ubuntu 12.04 machine. I removed them all, and installed openmpi again; however, after fixing that (I never try before that), my MPI always gives rank=0, size = 1. The reason is that the removal process is incomplete, hence causes file sharing conflict. It can be seen from the following test

beta@landmark:~$ whereis mpicc
mpicc: /usr/bin/mpicc.mpich2 /usr/bin/mpicc.openmpi /usr/bin/mpicc 
/usr/bin/X11/mpicc.mpich2 /usr/bin/X11/mpicc.openmpi /usr/bin/X11/mpicc 
/usr/share/man/man1/mpicc.1.gz

It turns out that the packages libmpich2-3 and libmpich2-dev failed to be removed. So after apt-get remove libmpich2-3 libmpich2-dev, everything goes fine.