Skip to content

Instantly share code, notes, and snippets.

View asttest.go
package main
import (
"fmt"
"go/ast"
"go/parser"
"go/token"
"io/ioutil"
"os"
"os/exec"
View DI_sample.scala
import com.google.inject.{AbstractModule, Guice}
trait Service
trait Client
trait Factory {
def newClient(n: Node): Client
def newService(n: Node): Service
}
case class Node(host: String, port: Int)
@yanolab
yanolab / printnif.go
Created Sep 7, 2015
print network interfaces and mask.
View printnif.go
package main
import (
"fmt"
"net"
)
func main() {
ifaces, err := net.Interfaces()
if err != nil {
@yanolab
yanolab / reverse-scrolling.ahk
Created Aug 24, 2015
Reverse scrolling likes MacOS X
View reverse-scrolling.ahk
WheelUp::
Send {WheelDown}
Return
WheelDown::
Send {WheelUp}
Return
@yanolab
yanolab / libgofib.go
Created May 21, 2015
sample of shared library for go1.5(cgo)
View libgofib.go
package main
import (
"C"
"log"
)
//export fib
func fib(n int) int {
if (n < 2) { return n }
@yanolab
yanolab / clip2img.py
Created Aug 27, 2014
Save image from clipboard to local file.
View clip2img.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import gtk
def save_clipimg(filename):
clipboard = gtk.clipboard_get()
image = clipboard.wait_for_image()
@yanolab
yanolab / .conkyrc
Last active Aug 29, 2015
My conkyrc file for dynabook KIRA
View .conkyrc
# .conkyrc
alignment bottom_left
gap_x 0
gap_y 0
background no
use_xft yes
xftfont Bitstream Vera Sans Mono:size=10:Bold
View coins.py
# -*- coding: utf-8 -*-
def product(v, coins=[500, 100, 50, 10, 5, 1], used=[]):
if len(coins) == 1:
yield 1
else:
for i, coin in enumerate(coins):
diff = v - coin
if diff == 0:
yield 1
View tour71.go
package main
import (
"fmt"
"sync"
)
var workerSize = 4
type Fetcher interface {
@yanolab
yanolab / gohttp.go
Last active Dec 24, 2015
Simple GO static web contents server.
View gohttp.go
package main
import (
"errors"
"flag"
"fmt"
"log"
"net"
"net/http"
"os"