This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abort() { | |
>&2 echo $@ | |
exit 1 | |
} | |
declare_resources() { | |
for r in $@; do | |
eval ${r}'() { echo "['${r}']=${1:?}"; }' | |
done | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
base=(/sys/class/power_supply/BAT* ) | |
base=${base[0]} | |
if [ ! -d $base ]; then | |
echo 'Battery is not detected.' 1>&2 | |
exit 1; | |
fi | |
now=`cat ${base}/energy_now` | |
full=`cat ${base}/energy_full` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html style='background-color:gray'> | |
<head> | |
<style> | |
* { | |
margin:0; | |
padding:0; | |
font-family: 'AppleGothic'; | |
} | |
.container { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (query) { | |
engines = { | |
'g' : function (q) { return 'https://www.google.com/search?q=' + q }, | |
'd' : function (q) { return 'https://duckduckgo.com/?q=' + q }, | |
'y' : function (q) { return 'http://search.yahoo.com/search?p=' + q }, | |
'w' : function (q) { return 'http://en.wikipedia.org/wiki/' + q }, | |
't' : function (q) { return 'https://twitter.com/search?q=' + q }, | |
'b' : function (q) { return 'http://www.bing.com/search?q=' + q }, | |
}; | |
defEngine = Object.keys(engines)[0]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## Put a pixel at (x,y). Position x and y are given by argument $1 | |
## and $2. The color of the pixel is given by $3, which runs 0 - 7 | |
function putPixel { | |
if [ $# -lt 3 ]; then | |
echo too few arguments >&2 | |
return 1 | |
fi | |
x=`echo "$1 * 2" | bc` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* What's this ? | |
* ============= | |
* | |
* This is a test program for 3D controller using a `SlimBlade` produced | |
* by Kensinton. For detail of SlimBlade, see the following URL : | |
* http://www.kensington.com/kensington/us/us/p/1444/K72327US/slimblade™-wired-media-trackball.aspx | |
* | |
* You can rotate displaied 3D object by using your SlimBlade. If you | |
* don't have SlimBlade, you can use your mouse device and its wheel. |
NewerOlder