Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View zhaostu's full-sized avatar

Stu Zhao zhaostu

View GitHub Profile
@zhaostu
zhaostu / remove_old_kernels.sh
Created October 20, 2012 03:48
One-liner to remove old Linux kernels in Ubuntu
## Note: This is only tested in the latest Ubuntu distributions.
## Please make sure packages to be removed are correct.
## http://stuzhao.blogspot.com/2012/10/remove-old-linux-kernels-in-ubuntu.html
dpkg -l | awk '{print $2}' | grep "linux-\(image\|headers\)-[0-9]" | grep -v `uname -r | sed s/-generic//` | xargs sudo apt-get purge -y
@zhaostu
zhaostu / remove_residual_config.sh
Created October 21, 2012 19:16
One-liner to remov all residual config packages in Ubuntu
# Remove all the packages with residual configuration.
# http://stuzhao.blogspot.com/2012/07/removing-all-residual-config-packages.html
sudo apt-get remove --purge `dpkg -l | grep '^rc' | awk '{print $2}'`
@zhaostu
zhaostu / !.md
Last active August 25, 2020 08:40
Configure Synaptics/ALPS/ElanTech touchpad for Chromium OS.
@zhaostu
zhaostu / android
Last active December 8, 2017 17:25
Android-x86 and Chromium OS grub2 entries.
menuentry "Android-x86" {
savedefault
set root='(hd0,3)'
linux /android-4.0-RC2/kernel quiet root=/dev/ram0 androidboot.hardware=asus_laptop acpi_sleep=s3_bios,s3_mode SRC=/android-4.0-RC2
initrd /android-4.0-RC2/initrd.img
}

Usage

wget -qO- http://goo.gl/xkyeeW | bash

@zhaostu
zhaostu / fft.go
Last active August 2, 2018 06:28
PortAudio example
package main
import (
"math"
"math/cmplx"
)
func isPowerOfTwo(n int) bool {
for n&1 == 0 && n > 1 {
n >>= 1
package main
import (
"image"
"image/color"
"image/draw"
"image/png"
"log"
"math"
"os"