Skip to content

Instantly share code, notes, and snippets.

View shokai's full-sized avatar

Sho Hashimoto shokai

View GitHub Profile
{
"東京": {
"where": "東京",
"geo": {
"latitude": 35.681085,
"longitude": 139.76672
},
"observation": {
"rain": 0,
"date": "2016-01-20T17:20:00.000Z"
@shokai
shokai / twitter-search-ltsv.es6
Last active January 6, 2016 10:00
twitter検索してltsv出力
/*
* https://dev.twitter.com/rest/reference/get/search/tweets
* https://github.com/desmondmorris/node-twitter/tree/master/examples#search
*/
"use strict";
require("dotenv").load();
import _ from "lodash";
// フィボナッチ数列をどんどん生成してprintする
"use strict";
var fibGenerator = regeneratorRuntime.mark(function fibGenerator() {
var fibs;
return regeneratorRuntime.wrap(function fibGenerator$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>hue-korg-control</string>
<key>UserName</key>
<string>sho</string>
<key>WorkingDirectory</key>
<string>/Users/sho/src/node/hue-korg-control</string>
@shokai
shokai / slack-reaction.coffee
Last active April 16, 2022 15:56
notify "reaction_added" event for slack.com
# Description:
# notify "reaction_added" event for slack.com
# http://shokai.org/blog/archives/10344
#
# Author:
# @shokai <hashimoto@shokai.org>
debug = require('debug')('hubot:slack-reaction')
_ = require 'lodash'
@shokai
shokai / dot.zshrc
Last active August 29, 2015 14:23
Enterキー押す毎にJXAでiTerm2の背景を変える http://shokai.org/blog/archives/10159
function iterm-bg-image-random(){
zle accept-line
if [[ -z "$BUFFER" ]]; then
$(iterm-bg-image ~/Pictures/写真\ Library.photoslibrary -r > /dev/null 2>&1 &)
fi
}
zle -N iterm-bg-image-random
bindkey '^m' iterm-bg-image-random
#!/usr/bin/osascript
on run argv
tell application "iTerm"
tell the current terminal
tell the current session
set background image path to item 1 of argv
end tell
end tell
end tell
end run
@shokai
shokai / Gemfile
Created June 6, 2015 00:34
capture webpage with capybara-webkit
source "https://rubygems.org"
gem "capybara-webkit"
@shokai
shokai / hue-korg-control.service
Last active August 29, 2015 14:22
https://github.com/shokai/hue-korg-control をEdisonのサービスにインストール
/lib/systemd/system/edison_config.service を参考にした
/lib/systemd/system/hue-korg-control.service に配置
% systemctl enable hue-korg-control
% systemctl start hue-korg-control
@shokai
shokai / 1-9.rb
Last active August 29, 2015 14:22
# http://www.softantenna.com/wp/software/5-programming-problems/
# 1+2+34-5+67-8+9 == 100 のようなのを全て見つける
operators = ['+','-','']
0.upto(operators.length**8-1).each do |i|
exp = 1.upto(9).map{|n|
n == 9 ? n : n.to_s + operators[(i%(operators.length**n))/(operators.length**(n-1))]
}.join()
puts "#{exp} == 100" if eval(exp) == 100