Skip to content

Instantly share code, notes, and snippets.

View oinume's full-sized avatar
🏠
Working from home

oinume oinume

🏠
Working from home
View GitHub Profile
@oinume
oinume / hello.ts
Last active August 29, 2015 13:56
A simple express application with TypeScript.
import express = require('express');
import http = require('http');
var app = express();
app.set('port', process.env.PORT || 3000);
app.get('/', function(req: express.Request, res: express.Response) {
res.send('Hello world!');
});
http.createServer(app).listen(app.get('port'), function() {
# -*- coding: utf-8 -*-
# $ pip install beaker flask redis git+git://github.com/bbangert/beaker_extensions.git
from flask import Flask, session
from flask.sessions import SessionInterface
from beaker.middleware import SessionMiddleware
session_opts = {
'session.type': 'redis',
  • a
  • b
  • c
  • d
package main
import (
"errors"
"fmt"
"os"
_ "github.com/go-sql-driver/mysql"
"github.com/go-xorm/xorm"
_ "github.com/mattn/go-sqlite3"
package main
import (
"fmt"
"os"
"github.com/miekg/dns"
"strings"
)
{
"builders":[
{
"type":"virtualbox-ovf",
"source_path":"/Users/kazuhiro/.vagrant.d/boxes/oinume-VAGRANTSLASH-ubuntu-14.04-jp/1.0.1/virtualbox/box.ovf",
"ssh_username":"vagrant",
"ssh_password":"vagrant",
"ssh_wait_timeout":"30s",
"shutdown_command":"echo 'vagrant' | sudo -S shutdown -P now"
}
#!/usr/bin/env perl
use strict;
use warnings;
use Getopt::Compact;
use Data::Dumper;
my $getopt = Getopt::Compact->new(
name => 'mygzip',
modes => [ qw(verbose) ],
@oinume
oinume / to_innodb.py
Created February 21, 2011 11:02
Convert all tables to InnoDB
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# INSTALL ====================
# $ sudo easy_install argparse
# $ sudo easy_install mysql-python
import argparse
import MySQLdb
import os
@oinume
oinume / StringBuilder_VS_StringFormat.java
Created September 4, 2011 13:40
Benchmark to concat strings with StringBuilder#append() and String.format()
package net.lampetty.samples;
/**
* StringBulder V.S. String.format to concat strings.
*/
public class StringBuilder_VS_StringFormat {
public static void main(String[] args) {
new StringBuilder_VS_StringFormat().run(args);
}
@oinume
oinume / kwargs.py
Created December 3, 2011 06:48
**つけるとdictオブジェクトをキーワード引数に変換できる
def f(**kwargs):
for k, v in kwargs.iteritems():
print "%s => %s" % (k, v)
f(**{ 'key1': 'value1', 'key2': 'value2' })
# output:
# key2 => value2
# key1 => value1