Skip to content

Instantly share code, notes, and snippets.

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

Shin'ya Ueoka ueokande

🙆‍♀️
LGTM
View GitHub Profile
function waitForKintone(success, error, timeout) {
const startAt = new Date().getTime();
function recursive() {
if (window.hasOwnProperty('kintone')) {
console.log("has kintone");
func();
} else if (new Date().getTime() - startAt > timeout) {
console.log("not has kintone");
error();
#!/bin/sh
print_primes() {
for i in `seq 6 $1`; do
test=$(echo $i | factor | awk 'NF==2{print $2}')
if [ -n "$test" ]; then
echo $i
fi
done
}
@ueokande
ueokande / notification-on-hatenablog.html
Last active October 6, 2016 12:34
Notification on hatenablog
<style>
.popup {
position: relative;
left: 32px;
right: 32px;
bottom: 32px;
background-color: #333;
color: white;
position: fixed;
padding: 16px;
@ueokande
ueokande / morse_led.cpp
Created April 1, 2016 23:38
Morse Code for LED in Linux
#include <iostream>
#include <chrono>
#include <thread>
#include <vector>
#include <cstdio>
constexpr std::chrono::milliseconds operator""_tick(unsigned long long int tick) {
return std::chrono::milliseconds(tick * 200);
}
@ueokande
ueokande / xgamma_dialog
Created March 13, 2016 09:12
Gamma configuration by Dialog
#!/bin/bash
value=$(dialog --rangebox 'Gamma' 10 72 -10 10 0 2>&1 >/dev/tty)
[[ $? -ne 0 ]] && exit 1
gamma=$(python -c "print(10 ** ($value / 10))")
xgamma -gamma $gamma
xgamma 2>&1 | cut -f 10 -d' '
@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);
});
});
});
@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 / 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 / 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 / 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...>) {