Skip to content

Instantly share code, notes, and snippets.

View uiur's full-sized avatar

Kazato Sugimoto uiur

View GitHub Profile
@uiur
uiur / gyazo-real.rb
Last active August 29, 2015 14:22
サーバー不要でセキュアな社内Gyazoクライアント
#!/usr/bin/env ruby
image_file = "/tmp/gyazo_printer#{$$}.png"
pdf_file = "/tmp/gyazo_printer#{$$}.pdf"
`screencapture -i #{image_file}`
`sips -s format pdf #{image_file} --out #{pdf_file}`
`lpr #{pdf_file}`
var mdns = require('multicast-dns')()
var ip = require('ip')
mdns.on('query', function (query) {
if (query.questions[0] && query.questions[0].name === 'dj.local') {
mdns.respond([
{ name: 'dj.local', type: 'A', data: ip.address() },
{ name: 'dj.local', type: 'AAAA', data: ip.address('ipv6') }
])
}
@uiur
uiur / snippet.cson
Created May 27, 2015 03:02
Atom javascript snippets that comform to JavaScript Standard Style
'.source.js':
'Prototype':
'prefix': 'proto'
'body': '${1:class_name}.prototype.${2:method_name} = function (${3:first_argument}) {\n\t${0:// body...}\n}'
'Function':
'prefix': 'fun'
'body': 'function ${1:function_name} (${2:argument}) {\n\t${0:// body...}\n}'
'Generator':
'prefix': 'gen',
'body': 'function* ${1:function_name} (${2:argument}) {\n\t${0:// body...}\n}'
@uiur
uiur / assign.js
Created May 21, 2015 07:11
assign history.state
function assign (object) {
history.replaceState(
Object.assign(history.state, object),
document.title
)
}
@uiur
uiur / a.md
Created April 27, 2015 15:15
list output audio devices
~% say --audio-device ?
  209 AirPlay
   38 Built-in Output
  198 Soundflower (2ch)
   63 Soundflower (64ch)
   55 VoilaDevice
@uiur
uiur / a.sh
Created April 24, 2015 00:58
mocha coffee react test
mocha --compilers coffee:coffee-react/register test.coffee
@uiur
uiur / reload.sh
Created April 23, 2015 09:26
Reload chrome extensions using chrome-cli
#!/bin/bash -e
id=$(chrome-cli list links | grep "chrome://extensions/" | awk '{print $1}' | sed -E "s/^\[([0-9]+)\]$/\1/g")
if [[ -n $id ]] ; then
chrome-cli reload -t "$id"
else
chrome-cli open "chrome://extensions"
fi
@uiur
uiur / tty.sh
Created April 21, 2015 16:14
tty -> tty
cat /dev/tty | tee /dev/ttys000
cat /dev/tty > /dev/ttys000
@uiur
uiur / nkf.rb
Last active August 29, 2015 14:19
euc-jp -> utf-8
require 'json'
list = Dir.glob('wiki/*.txt').map do |path|
title = `echo #{path} | xxd -r -p | nkf -E -w`
body = `cat #{path} | nkf -E -w`
{
title: title,
body: body
}
@uiur
uiur / ichi.sh
Created April 20, 2015 06:48
現在位置座標のURL開く
open "https://www.google.co.jp/maps/place/$(whereami --format sexagesimal | perl -MURI::Escape -ne 'print uri_escape($_)')"