Skip to content

Instantly share code, notes, and snippets.

@poppen
poppen / main.go
Last active January 7, 2018 05:02
package main
import (
"encoding/json"
"fmt"
"log"
"github.com/garyburd/redigo/redis"
)
@poppen
poppen / rec_radiru.sh
Last active September 17, 2017 02:10
らじるらじる録音スクリプト forked from https://gist.github.com/poppen/0e054e20947d56756c489f74c7f53d0e
#!/bin/bash
set -eu
XML_URL="http://www.nhk.or.jp/radio/config/config_web.xml"
XML="/tmp/config_web.xml.$$"
trap 'rm $XML; exit 1' 1 2 3 15
date=$(date '+%Y-%m-%d-%H-%M')
@poppen
poppen / init.lua
Last active May 18, 2018 23:44
KarabinerでやっていたことをHammerspoonで代替する(USキーボード用)
local VK_SEMICOLON = 0x29
local VK_ESC = 0x35
local VK_RIGHT_BRACKET = 0x21
local VK_J = 0x26
-- Auto reload config
function reloadConfig(files)
doReload = false
for _,file in pairs(files) do
if file:sub(-4) == ".lua" then
a = [1,2,3,4]
for i in a do
a.push(i)
end
kernel = command('uname -r').stdout.chop!
describe package("linux-image-extra-#{kernel}") do
it { should be_installed }
end
@poppen
poppen / webcrawler.go
Last active August 11, 2016 01:13
Exercise: Web Crawler
package main
import (
"fmt"
"sync"
)
type Fetcher interface {
// Fetch returns the body of URL and
// a slice of URLs found on that page.
@poppen
poppen / 0_reuse_code.js
Created August 10, 2016 03:10
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
package main
import (
"io"
"os"
"strings"
)
type rot13Reader struct {
r io.Reader
package main
import "golang.org/x/tour/reader"
type MyReader struct{}
// TODO: Add a Read([]byte) (int, error) method to MyReader.
func (r MyReader) Read(b []byte) (int, error) {
b[0] = 'A'
return 1, nil
@poppen
poppen / rec_radiru.sh
Last active September 10, 2017 10:41
らじるらじる録音スクリプト forked from http://www.geocities.jp/mrsd_tangerine/rec_radiru.sh
#!/bin/bash
LANG=ja_JP.utf8
date=`date '+%Y-%m-%d-%H-%M'`
outdir="."
#引数:[Ch.名] [録音秒数] [出力先] [ファイル名]
# [録音秒数]は30秒増しに録られる
# [ファイル名]は[ファイル名]-YYYY-MM-DD-HH-mm.m4aで保存される。デフォルトは[Ch.名]