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:7568836
Created November 20, 2013 18:54
The ``smlnj`` package cannot be located by simply doing ``sudo apt-get install smlnj`` in ubuntu 12.04. It can be installed by running the following code.
beta@landmark:~$ sudo add-apt-repository ppa:hrzhu/smlnj-backport
beta@landmark:~$ sudo apt-get update
beta@landmark:~$ sudo apt-get install smlnj
beta@landmark:~$ sml
Standard ML of New Jersey v110.75 [built: Tue Aug 20 07:15:06 2013]
-
@ozooxo
ozooxo / gist:7811145
Last active December 30, 2015 09:39
Tools like highlight.js can help detecting the name of a programming language from a piece of code. The set up in ubuntu is as follows. You can further decrease the number of programming languages by commenting the potential languages in line 641--707 of highlight.js file. It can increase the speed a little bit, but it's still to slow for a huge…
beta@landmark:~/Downloads$ sudo apt-get install nodejs
beta@landmark:~/Downloads$ sudo apt-get install npm
beta@landmark:~/Downloads$ npm install highlight.js
beta@landmark:~/Downloads$ node
> var hljs = require('highlight.js');
undefined
> hljs.highlightAuto("<p>abc</p>").language;
'xml'
@ozooxo
ozooxo / gist:8009646
Created December 17, 2013 18:01
Repair ubuntu 12.04 X Window booting system

After trying to repair the touch-pad of my Ubuntu 12.04, the system cannot boot from X Window. It turns out that xserver-xorg is accidentally removed by sudo apt-get autoremove process after I installed xserver-xorg-input-synaptics. To repair it, just go to the recovery mode and

sudo apt-get install xserver-xorg
sudo dpkg-reconfigure xserver-xorg
@ozooxo
ozooxo / gist:8118784
Created December 24, 2013 23:30
Ubuntu 12.04 in my laptop cannot my own "magnetar" game. The reason is that the default java version is too old. It works after I manually changed it from openjdk-6 to openjdk-7.
sudo update-alternatives --config javac
sudo update-alternatives --config java
@ozooxo
ozooxo / gist:8962140
Created February 12, 2014 18:57
Run matlab in Ubuntu terminal: (Top one) quicker, but some plot-related functions seem not fully supported. (Bottom one) fully supported, but slower.
matlab -nojvm
matlab -nodesktop
@ozooxo
ozooxo / gist:8969388
Created February 13, 2014 03:44
merge two pdf files
pdftk HW1_word.pdf HW1_photo.pdf cat output HW1.pdf
@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.

@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: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: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/.