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 / 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 / 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 / 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 / tuple_tuils.cpp
Created April 22, 2015 13:41
C++ tuple utils
#include <tuple>
#include <iostream>
template <typename Tuple, size_t ...xs>
constexpr auto sub_tuple(const Tuple &t, std::index_sequence<xs...>) {
return std::make_tuple(std::get<xs>(t)...);
}
template <typename Tuple, size_t x, size_t ...xs>
constexpr auto sub_tail_tuple(const Tuple &t, std::index_sequence<x, xs...>) {
@ueokande
ueokande / cpp_closure.cpp
Last active August 29, 2015 14:20
C++ /= block
#include <functional>
#include <vector>
#include <iostream>
template <typename T>
class Array {
public:
Array(const std::initializer_list<T> &data)
: each(*this), keep_if(*this), data(data)
{}
@ueokande
ueokande / touchpadoff3.patch
Created August 2, 2015 01:10
Add TouchpadOff=3 to disable pointer motion only; http://patchwork.freedesktop.org/patch/12962/
diff --git a/man/synaptics.man b/man/synaptics.man
index 03f18ac..5f9702a 100644
--- a/man/synaptics.man
+++ b/man/synaptics.man
@@ -228,6 +228,7 @@ l l.
0 Touchpad is enabled
1 Touchpad is switched off
2 Only tapping and scrolling is switched off
+3 Only pointer motion is switched off
.TE
@ueokande
ueokande / gen_ssh_config
Created October 9, 2015 13:38
Generate SSH config
#!/bin/ruby
def add_host(host, options = {})
puts "Host #{host}"
options.each do |k, v|
puts "#{k} #{v}"
end
puts
end
@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.
@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 / electron_test.js
Last active March 4, 2016 14:23
ElectronのRendererプロセスのテスト ref: http://qiita.com/ueokande/items/ea5b985f0ebe0e84f29d
describe('Electron renderer process', function() {
describe('document object', function() {
it('is an Document object', function() {
expect(window.document).to.be.an.instanceof(Document);
});
});
});