Skip to content

Instantly share code, notes, and snippets.

@poppen
poppen / cube_roots.go
Created November 21, 2013 13:55
An answer of the exercise: Complex cube roots on a tour of go
package main
import (
"fmt"
"math/cmplx"
)
func Cbrt(x complex128) complex128 {
var z0, z1 complex128
z1 = 1.0
@poppen
poppen / wordcount.go
Created November 21, 2013 12:31
An answer of the exercise: Maps on a tour of go
package main
import (
"code.google.com/p/go-tour/wc"
"strings"
)
func WordCount(s string) map[string]int {
m := make(map[string]int)
for _, word := range strings.Fields(s) {
@poppen
poppen / sqrt.go
Last active December 28, 2015 23:39
An answer of the exercise: Loops and Functions on a tour of go
package main
import (
"fmt"
"math"
)
// func Sqrt(x float64) float64{
// z := 1.0
// for i := 0; i < 10; i++ {
@poppen
poppen / pic.go
Last active December 28, 2015 23:39
An answer of the exercise: Slices on a tour of Go
package main
import (
"code.google.com/p/go-tour/pic"
)
func Pic(dx, dy int) [][]uint8 {
s := make([][]uint8, dy)
for i := range s {
s[i] = make([]uint8, dx)
@poppen
poppen / gist:6255541
Created August 17, 2013 06:15
systemrescuecd-x86-3.7.1_usbbootable_isolinux.cfg
--- isolinux.cfg 2013-07-14 15:54:36.000000000 +0900
+++ 3.7.1-isolinux.cfg 2013-08-17 14:54:09.000000000 +0900
@@ -1,3 +1,9 @@
+##########################################################################################
+### original = http://www.sysresccd.org/
+### edit by yassy http://www10.plala.or.jp/palm84/
+### http://www10.plala.or.jp/palm84/multiiso.html
+### http://www10.plala.or.jp/palm84/archives/multiiso/config/systemrescuecd_isolinux.cfg
+##########################################################################################
UI vesamenu.c32
--- systemrescuecd-x86-3.4.1_isolinux.cfg 2013-02-22 03:33:30.000000000 +0900
+++ systemrescuecd-x86-3.4.1_usbbootable_isolinux.cfg 2013-08-17 05:29:28.000000000 +0900
@@ -1,3 +1,9 @@
+##########################################################################################
+### original = http://www.sysresccd.org/
+### edit by yassy http://www10.plala.or.jp/palm84/
+### http://www10.plala.or.jp/palm84/multiiso.html
+### http://www10.plala.or.jp/palm84/archives/multiiso/config/systemrescuecd-x86-3.4.1_isolinux.cfg
+##########################################################################################
UI vesamenu.c32
@poppen
poppen / radiru_rec.sh
Created June 21, 2013 05:31
wrapper script for rtmpdump to record NHK radiruradiru
#!/bin/bash
usage_exit() {
echo "Usage: $0 [-c channel (r1/r2/fm, default:r1)] [-t recording_seconds (default:1800)] " 1>&2
echo " r1: NHK-Radio No.1 / r2: NHK-Radio No.2 / fm: NHK-FM"
exit 1
}
#
# options
@poppen
poppen / nginx.conf
Last active June 4, 2021 08:16
nginx.conf for tDiary server
upstream tdiary {
server localhost:19292;
}
server {
root /path/to/tdiary;
index index.html index.htm;
server_name tdiary.example.org;
@poppen
poppen / tdiary-server.conf
Last active December 18, 2015 04:48
upstart script for tDiary server
description "tdiary-server"
start on runlevel [2345]
stop on runlevel [!2345]
respawn # respawn the service if it dies
respawn limit 5 10 # stop respawning if it fails 5 times in 10 seconds
env PATH=/usr/local/rbenv/shims:/usr/local/rbenv/bin:/usr/local/bin:/usr/bin:/bin
@poppen
poppen / gist:5727476
Created June 7, 2013 06:49
the appended CSS for my tDiary
* {
margin: 0px;
padding: 0px;
}
body {
text-align: center;
width: 100%;
height: 100%;
background-image: url(http://farm8.staticflickr.com/7433/8975024902_c5f2e1f449_o_d.jpg);