Skip to content

Instantly share code, notes, and snippets.

View ueokande's full-sized avatar
🙆‍♀️
LGTM

Shin'ya Ueoka ueokande

🙆‍♀️
LGTM
View GitHub Profile
@ueokande
ueokande / bachef.sh
Last active March 21, 2019 00:47
Bachef - Chef like bash DSL
abort() {
>&2 echo $@
exit 1
}
declare_resources() {
for r in $@; do
eval ${r}'() { echo "['${r}']=${1:?}"; }'
done
}
@ueokande
ueokande / battery-state.sh
Last active August 29, 2015 14:09
Get buttery state
#!/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`
@ueokande
ueokande / comparison_of_CSS_SVG_Canvas.html
Last active August 29, 2015 14:08
comparison_of_CSS/SVG/Canvas
<!DOCTYPE HTML>
<html style='background-color:gray'>
<head>
<style>
* {
margin:0;
padding:0;
font-family: 'AppleGothic';
}
.container {
@ueokande
ueokande / vimium_search_engine.js
Last active August 29, 2015 14:02
Vimium Search Engine
(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];
@ueokande
ueokande / sin-terminal.sh
Last active December 29, 2015 14:59
A script which draws sin graph in terminal
#!/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`
@ueokande
ueokande / slimbladegl.c
Created October 25, 2013 13:25
Test program for 3D controller using a SlimBlade.
/*
* 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.