Skip to content

Instantly share code, notes, and snippets.

View stanwu's full-sized avatar

Stan Ht. Wu stanwu

View GitHub Profile
@stanwu
stanwu / archive_all.sh
Created July 24, 2012 18:23
archive all files to target folder
#!/bin/sh
for i in tar.gz tgz tar.bz2 zip rar
do
find -name "*.$i" -exec archive "{}" true \;
done
@stanwu
stanwu / make_md5.sh
Created July 25, 2012 03:22
batch make md5 check sum for files (find -exec)
#!/bin/bash
b=`basename "$1"`
d=`pwd`
echo "[RUN] Check [$b] $d/$1"
if [ -f "$1" ]; then
if [ -s "$1.md5" ]; then
s=`cat "$1.md5" | awk '{print $1}'`
@stanwu
stanwu / swap368.sh
Created July 26, 2012 13:41
make a swap file
#!/bin/bash
dd if=/dev/zero of=swap368.bin bs=1M count=128
mkswap swap368.bin
swapon swap368.bin
@stanwu
stanwu / archive2.sh
Created July 27, 2012 04:38
archive2
#!/bin/bash
my_target="/mnt/nfs/stan/archives"
b=`basename "$1"`
d=`pwd`
echo "[RUN] Check [$b] $d/$1"
if [ -f "$1" ]; then
if [ -e "$my_target/$b" ]; then
@stanwu
stanwu / archive2_all.sh
Created July 27, 2012 04:39
archive2_all.sh
#!/bin/sh
for i in tar.gz tgz tar.bz2 zip rar
do
find -size +10240k -name "*.$i" -exec archive2 "{}" true \;
done
@stanwu
stanwu / make_md5_all.sh
Created July 27, 2012 04:40
make_md5_all.sh
#!/bin/sh
for i in tar.gz tgz tar.bz2 zip rar
do
find -size +10240k -name "*.$i" -exec make_md5.sh "{}" \;
done
@stanwu
stanwu / .bashrc
Created July 29, 2012 18:29
touchpad on/off (ubuntu)
alias s1="synclient TouchpadOff=1"
alias s0="synclient TouchpadOff=0"
@stanwu
stanwu / HelloWorldApp.java
Created September 13, 2012 14:14
HelloWorldApp class
/**
* The HelloWorldApp class implements an application that
* simply prints "Hello World!" to standard output.
*/
class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!"); // Display the string.
changeCadence(10);
printStates();
}
@stanwu
stanwu / bkup.sh
Created February 9, 2013 07:30
backup to ftp
tar -cpz `cat list` | curl -u username:password ftp://ftp.xxxxxx.com/xxxxxx-backup.tgz -T -
@stanwu
stanwu / pack_android4.0.sh
Created February 11, 2013 02:32
packing android
#!/bin/ash
buf="abi bionic bootable build cts dalvik development device docs external frameworks hardware libcore ndk out packages prebuilt sdk system"
for i in $buf
do
echo "pack android4.0_$i.tgz"
tar cvzf android4.0_$i.tgz $i
done