Skip to content

Instantly share code, notes, and snippets.

View minikomi's full-sized avatar
🍕
I like pizza

minikomi

🍕
I like pizza
  • Tokyo, Japan
View GitHub Profile
@lrvick
lrvick / flask_geventwebsocket_example.py
Created September 1, 2011 07:17
Simple Websocket echo client/server with Flask and gevent / gevent-websocket
from geventwebsocket.handler import WebSocketHandler
from gevent.pywsgi import WSGIServer
from flask import Flask, request, render_template
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
require 'camping'
Camping.goes :Async
module Async
def service(*a)
return super unless respond_to?(:async?)
EM.next_tick do
send(@method, *a)
@hanachin
hanachin / Gemfile
Created November 28, 2011 16:09
CLI Twitter Client.
source "http://rubygems.org"
gem "highline"
gem "twitter"
gem "escape_utils"
@ctataryn
ctataryn / gist:1401486
Created November 28, 2011 18:46
Clojure Create Tables
(ns my.ns
(:use [korma.db])
(:use [korma.core])
(:require [clojure.java.jdbc :as sql]))
(def dbspec {:classname "org.h2.Driver"
:subprotocol "h2"
:subname "~/db/myapp"
:user "sa"
:password ""})
@kylelemons
kylelemons / piping.go
Last active May 31, 2024 09:07 — forked from dagoof/piping.go
piping exec.Cmd in golang (example sorts all regular files under a directory by their extension)
package main
import (
"bytes"
"exec"
"log"
"os"
)
// Pipeline strings together the given exec.Cmd commands in a similar fashion
def output name=((default=true); "caius")
puts "name: #{name.inspect}"
puts "default: #{default.inspect}"
end
output
# >> name: "caius"
# >> default: true
output "avdi"
@hkb
hkb / decorator_skeleton.py
Created January 2, 2012 16:11
Basic skeleton for python decorators.
# A base skeleton to simplify decorator implementations.
#
# All decorator classes needs only to extend this class by implementing the
# _init() and _call() methods and do not have to worry about the inconsistency
# of python decorators.
#
# _init: The method is called once when the decorator is created. The decorator
# arguments, if any, will be passed on to this method.
# _call: Implements the function call, all arguments to the function will be
# passed on to this method.
@dustin
dustin / stdinweb.go
Created February 9, 2012 03:57
A web server that runs out of inetd
package main
import (
"errors"
"fmt"
"net"
"net/http"
"os"
"time"
)
@axelav
axelav / linux-directory-structure.md
Last active September 30, 2015 18:58
Quick summary of Linux directory hierarchy

Linux directory heirarchy


/bin binaries, basic Linux commands are here

/boot boot code, leave it be

/dev all devices/hardware, all treated as a stream

@bgentry
bgentry / spdy-server.go
Created February 27, 2012 02:01
A simple SPDY server
// Based heavily on https://bitbucket.org/zombiezen/spdy, adapted for
// recent Go releases.
package main
import (
"crypto/tls"
"fmt"
"go.net/spdy"
"io"