Skip to content

Instantly share code, notes, and snippets.

@terryoy
terryoy / rc.xml
Last active December 16, 2015 19:38
在Openbox里实现像Windows7那样的Window snap功能 (即Win+left或right时,附着在屏幕左边或右边并以半屏大小显示,Win+Up的时候最大化,Win+Down时取消最大化)
<!-- Add following content in .config/openbox/rc.xml -->
<!-- After saving, execute "openbox --reconfigure" to refresh -->
<!-- Ref: https://wiki.archlinux.org/index.php/Openbox#Window_snap_behaviour -->
<keybind key="W-Left">
<action name="UnmaximizeFull"/>
<action name="MaximizeVert"/>
<action name="MoveResizeTo">
<width>50%</width>
</action>
@terryoy
terryoy / compile_and_run.sh
Created January 28, 2013 05:52
Linux VGA Programming Helloworld
# pre-requisities: sudo apt-get install libsvga1 libsvga1-dev
gcc -lvga helloworld.c -o helloworld
sudo ./helloworld
# output:
# (on screen: a small red point displaying for 5 sec)
# (on console: [svgalib: allocated virtual console #8])
@terryoy
terryoy / serial_related.py
Last active December 11, 2015 07:18
Python Script Collections
@terryoy
terryoy / gist:4518272
Last active December 11, 2015 00:39
Linux Shell Programming
### IO redirecting ###
# "2" is stderr
kill -HUP >killout 2>killerr.txt
# add stderr to the same file as stdout
kill -l 1234 >killout 2>&1
# output to "Recycle Bin"
kill -l 1234 >/dev/null 2>&1
# redirect stdin
more < killout.txt
@terryoy
terryoy / gist:4475888
Last active December 10, 2015 18:38
Compile C program under linux
$ vi hello.c
# #include <stdio.h>
#
# int main() {
# printf("Hello world!\n");
# exit(0);
# }
$ gcc -o hello hello.c
hello.c: In function ‘main’:
@terryoy
terryoy / gist:4461444
Last active December 10, 2015 16:28
Archlinux Installation Script
# create and format the partitions
fdisk /dev/sda
# n (new partition)
# +100M (for /boot)
# n
# +15G (for / including /usr)
# n
# +8G (for /var)
# n
# (for the rest, extended)
@terryoy
terryoy / gist:4435265
Last active April 7, 2022 22:33
My Gentoo Shell Command Collection
### emerge package management (need root access) ###
### "emerge" is a tool manipulating Gentoo's package management tool "Portage" ###
# update portage tree
emerge --sync
# search package
emerge --search pdf
emerge --searchdesc pdf
@terryoy
terryoy / gist:4411528
Last active October 6, 2018 09:49
My Gentoo Install Command List(under VirtualBox)
# Reference: http://www.gentoo.org/doc/zh_cn/gentoo-x86-quickinstall.xml
##########################################################################
##### part 1: boot with gentoo minimal #####
# boot
gentoo
# config network
net-setup eth0
ifconfig
@terryoy
terryoy / gist:4369681
Created December 24, 2012 15:38
django tastypie, userena setup
# install userena
pip install django-userena
# a simple catpcha for django
pip install django-simple-captcha
# install dependencies for pil and captcha
sudo apt-get install libjpeg libjpeg-dev libfreetype6 libfreetype6-dev zlib1g-dev
# install pil
pip install pil
@terryoy
terryoy / gist:4359184
Last active December 10, 2015 01:28
SVN Commands
# Checkout source
svn co SVN_URL [PATH] [--username USERNAME] [--password PASSWORD] [-r REVISION]
# Add an unversioned(new) FILE or DIR to the version control system
svn add FILE
# show the current conflict/modified/new status of working directories and files
svn status
# You should always do a manual svn status --show-updates before trying to commit
# changes in order to check that everything is OK and ready to go.