Skip to content

Instantly share code, notes, and snippets.

@poppen
poppen / crontab
Last active May 14, 2017 02:02
簡易Radiko録音ツール。要swftools/rtmpdump/libxml/wget/ffmpeg/lame
# aliceorder
30 1 * * 1 sh ~/workspace/radio/radiko/src/rec_radiko.sh QRR 31 ~/workspace/radio/radiko/data radio_order
# sumipe
0 0 * * 0 sh ~/workspace/radio/radiko/src/rec_radiko.sh QRR 31 ~/workspace/radio/radiko/data heart
package main
import (
"fmt"
"math"
)
func Sqrt_10(x float64) float64 {
i := 0
z := 1.0
#!/bin/bash
IP_ADDR=$1
while true; do
sleep 1
result=`/sbin/ping -q -c 1 $IP_ADDR 2>&1`
if [ $? -eq 2 ]; then
echo $result
terminal-notifier -message "packet to ${IP_ADDR} is lost!"
class Person
def has_holiday_in?(year, month)
calendar = new Calendar(year, month)
calendar.has_holiday? ? true : false
end
end
class Person
def has_holiday_in?(calendar)
calendar.has_holiday? ? true : false
@poppen
poppen / yamaha-dns-cache-clear.rb
Created July 7, 2014 00:38
clear dns cache script for yamaha routers
# -*- encoding: utf-8 -*-
# vim: set filetype=ruby expandtab tabstop=4 shiftwidth=4 autoindent smartindent:
require 'net/telnet'
require 'yaml'
routers = YAML.load_file(ARGV[0])
routers.each do |router|
begin
@poppen
poppen / Rakefile
Last active August 29, 2015 14:01
Rakefile for Docker
builder_name = ''
image_name = ''
publish_port = ''
expose_port = ''
tag = "#{builder_name}/#{image_name}"
if ENV['version']
tag += ":#{ENV['version']}"
end
#!/bin/bash
VENDOR="vendor"
cd $HOME
mkdir -p $VENDOR
cd $VENDOR
# advpng
@poppen
poppen / images.go
Created November 23, 2013 04:23
An answer of the exercise: Images on a tour of go
package main
import (
"code.google.com/p/go-tour/pic"
"image"
"image/color"
)
type Image struct {
Width, Height int
@poppen
poppen / http.go
Last active December 29, 2015 03:49
An answer of the exercise: Images on a tour of go
package main
import (
"net/http"
"fmt"
)
type String string
func (s String) ServeHTTP(w http.ResponseWriter, r *http.Request) {
@poppen
poppen / errors.go
Created November 23, 2013 03:11
An answer of the exercise: Errors on a tour of go
package main
import (
"fmt"
"math"
)
type ErrNegativeSqrt float64
func (e ErrNegativeSqrt) Error() string {