Skip to content

Instantly share code, notes, and snippets.

View atsuya046's full-sized avatar

Nobuya Oshiro atsuya046

View GitHub Profile
@atsuya046
atsuya046 / install nvm, node.js
Last active December 12, 2015 12:09
Ubuntuにnvmをインストールしてnode.jsを使う
$ sudo apt-get update
$ sudo apt-get install git curl build-essential libssl-dev
$ git clone https://github.com/creationix/nvm.git ~/.nvm
$ . ~/.nvm/nvm.sh
$ nvm install 0.6.13
$ sudo /home/ubuntu/.nvm/v0.6.13/bin/node -v
@atsuya046
atsuya046 / tmpBootstrap.html
Created May 3, 2013 03:30
template using bootstrap
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>
</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
/**
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes')
, user = require('./routes/user')
, http = require('http')
, path = require('path');
@atsuya046
atsuya046 / Update Android4.3
Created July 28, 2013 09:04
Galaxy NexusをAndroid4.3手動アップデート
$ cd yakju-jwr66v
$ adb reboot bootloader
$ ./flash-all.sh
@atsuya046
atsuya046 / create_django_pj
Last active December 20, 2015 14:39
How to create Django project.
$ django-admin.py startproject django_test
$ cd django_test/
$ python manage.py runserver
@atsuya046
atsuya046 / jsonToSqlite.py
Created December 14, 2013 09:09
create sqlite database file from json file
# -*- coding:utf-8 -*-
import json
import sqlite3
JSON_FILE = "some.json"
DB_FILE = "some.db"
traffic = json.load(open(JSON_FILE))
conn = sqlite3.connect(DB_FILE)
@atsuya046
atsuya046 / query.py
Created December 20, 2013 11:17
sqliteのクエリを組み立てるとき、配列の長さの分だけ"?"を作る
for row in csv.reader(data):
params = ', '.join(map(lambda s: '?', row))
c.execute('''insert into %s values (%s) ''' % (table_name, params), row)
@atsuya046
atsuya046 / Vagrantfile
Created December 31, 2013 05:23
Vagrantfile for EC2 Ubuntu instance.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Uncomment these lines (and the ones in the generated Gemfile) if you want
# to live on the Edge:
#
# Vagrant.require_plugin "vagrant-berkshelf"
# Vagrant.require_plugin "vagrant-omnibus"
Vagrant.configure("2") do |config|
@atsuya046
atsuya046 / Berkshelf
Created December 31, 2013 14:44
custom cookbook for install and setting nginx
#repo/Berkshelf
cookbook 'nginx', '~> 0.1.0', path: 'site-cookbooks/nginx'
@atsuya046
atsuya046 / template.py
Last active May 23, 2016 16:56
GoF design pattern with Python
"""http://ginstrom.com/scribbles/2007/10/08/design-patterns-python-style/
An example of the Template pattern in Python"""
ingredients = "spam eggs apple"
line = '-' * 10
# Skeletons
def iter_elements(getter, action):
"""Template skeletons that iterates items"""