Skip to content

Instantly share code, notes, and snippets.

View uiur's full-sized avatar

Kazato Sugimoto uiur

View GitHub Profile
@uiur
uiur / a.sh
Created April 24, 2015 00:58
mocha coffee react test
mocha --compilers coffee:coffee-react/register test.coffee
@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 / 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 / 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}'
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 / 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}`
// seeding
swarm.on('peer', function (peer) {
dht.addPeer(peer)
})
// signaling
// hub
hub.subscribe('/channel')
// peer
@uiur
uiur / download.sh
Last active August 29, 2015 14:22
download nhk news video
rtmpdump -r "rtmp://flv.nhk.or.jp/ondemand/flv/news/k10010107821_201506090918_201506090918.mp4" -o file.mp4
#!/bin/bash
ffmpeg -i "$1" -r 10 -f image2pipe -vcodec ppm - \
| convert -layers Optimize - gif:- \
| gifsicle -O3 --multifile -
@uiur
uiur / index.html
Created July 7, 2015 01:42
css and linear algebra
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="style.css" media="screen" title="no title" charset="utf-8">
</head>
<body>
<div class="box"></div>
</body>