Skip to content

Instantly share code, notes, and snippets.

View Leask's full-sized avatar
🏠
Working from home

Sixia "Leask" Huang Leask

🏠
Working from home
View GitHub Profile
@Leask
Leask / 1px_transparent.png
Created April 10, 2013 14:23
1px Transparent PNG
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCB1jYAAAAAIAAc/INeUAAAAASUVORK5CYII=
@Leask
Leask / bin_search.js
Last active December 16, 2015 05:09
Pac Binary Search
var list = [
// [2130706433, 4278190080],
// [167772160, 4278190080],
// [2886729728, 4293918720],
// [3232235520, 4294901760],
[16777216, 4294901760],
[16842752, 4294901760],
[16908288, 4294901760],
[16973824, 4294901760],
[17039360, 4294901760],
@Leask
Leask / keyboard_leds.c
Created April 24, 2013 18:52
Manipulate keyboard LEDs (capslock and numlock) programmatically. Copyright (c) 2007,2008 Amit Singh. All Rights Reserved.
/*
* keyboard_leds.c
* Manipulate keyboard LEDs (capslock and numlock) programmatically.
*
* gcc -Wall -o keyboard_leds keyboard_leds.c -framework IOKit
* -framework CoreFoundation
*
* Copyright (c) 2007,2008 Amit Singh. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
张三
李四
王五
张三
张三
@Leask
Leask / morse_code.txt
Created April 24, 2013 19:44
Learning Morse Code
A .-
B -. . .
C -. -.
D -. .
E .
F . .-.
G --.
H . . . .
I . .
J .---
@Leask
Leask / tree
Created July 18, 2013 05:09
Show directories as tree style
find . -type d | sed -e "s/[^-][^\/]*\// |/g" -e "s/|\([^ ]\)/|-\1/"
@Leask
Leask / pid
Last active December 19, 2015 22:38
Get pid by command (NOT ONLY by executable file name, different from `pidof` project) Sample: $ pid /usr/sbin/securityd -i
#!/bin/sh
# Flora Pid by LeaskH.com
# Main logic
aPs="`ps -ef | grep "$*" | grep -v "grep $*" | grep -v "$0 $*"`"
pid="`echo "$aPs" | grep -v "pid" | head -1 | awk '{print $2}'`"
if [ "$pid" ]; then
echo $pid
exit 0
fi
@Leask
Leask / sk
Last active December 19, 2015 22:38
Kill process by command (NOT ONLY by executable file name or pid, smarter than `killall`) Sample: $ sk /usr/sbin/securityd -i
#!/bin/sh
# Flora Smart Kill by LeaskH.com
# Main logic
aPs="`ps -ef | grep "$*" | grep -v "grep $*" | grep -v "$0 $*"`"
pid="`echo "$aPs" | grep -v "sk" | head -1 | awk '{print $2}'`"
if [ "$pid" ]; then
kill $pid # 2> /dev/null
echo $pid
exit 0
@Leask
Leask / n
Last active May 27, 2017 18:01
Use Sublime Text as a simple note taking tool
#!/bin/sh
# Flora Note by LeaskH.com
list() {
ls $note_path
}
edit() {
"$editor" $note_path
}
@Leask
Leask / runtime.php
Last active December 19, 2015 23:49
Tracking time elapsed for php program in millisecond
<?php
# Tracking time elapsed for php program in millisecond
# by @leaskh
class runtime {
var $StartTime = 0;
var $StopTime = 0;
function get_microtime() {