Skip to content

Instantly share code, notes, and snippets.

View shiroyuki's full-sized avatar
🇨🇦
Working

Juti Noppornpitak shiroyuki

🇨🇦
Working
View GitHub Profile
@shiroyuki
shiroyuki / gist:9114093
Created February 20, 2014 13:55
Sublime 3 User Config
{
"bold_folder_labels": true,
"color_scheme": "Packages/Theme - itg.flat/itg.dark.tmTheme",
"draw_white_space": "all",
"highlight_line": true,
"ignored_packages":
[
"Vintage"
],
"rulers":
@shiroyuki
shiroyuki / ajax-sandbox.js
Created November 20, 2013 00:10
ajax-sandbox
$.ajax({
url: '',
success: function(r) {console.log(r);},
headers: {
'Authorization': '',
'Accept': 'application/json'
}
});
@shiroyuki
shiroyuki / node-amqp-event-driven-arch-sample.js
Created May 6, 2013 16:03
Sample for node-amqp Event-driven Architecture
// This code is just conceptual to illustrate the proposed future change.
var amqp = require('amqp'),
connection = amqp.createConnection({ host: 'dev.rabbitmq.com' });
connection.on('ready', function () {
function onMyQueueMessageReceived(message) {
console.log(message);
}
@shiroyuki
shiroyuki / 20130403-council-ab.log
Created April 4, 2013 02:17
Benchmark of Council between MacBook Air (Intel Core i7 2.0 GHz, DDR3 SDRAM 8 GB) and Raspberry Pi (900 MHz, RAM 512 MB)
$ ab -n 1000 -c 10 http://10.0.0.12:8000/login
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 10.0.0.12 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
@shiroyuki
shiroyuki / mongod.conf
Created March 15, 2013 15:14
General MongoDB Configuration
bind_ip = 127.0.0.1
maxConns = 5
objcheck = false
logappend = true
fork = true
dbpath = /data/mongo/db
logpath = /data/mongo/daemon.log
noscripting = true
@shiroyuki
shiroyuki / tori.db-2.1-example.py
Last active December 12, 2015 10:38
The example on how to use ORM
from tori.db.document import document
from tori.db.manager import Manager
from tori.db.mapper import link, AssociationType
@document
class Computer(object):
def __init__(self, name):
self.name = name
@link('computer', Computer, association_type=AssociationType.ONE_TO_ONE)
@shiroyuki
shiroyuki / gist:4727981
Created February 7, 2013 02:43
Raspberry Pi Setup Procedure
export RPI_IMAGE=/Volumes/Sonata/Terminal/2012-12-16-wheezy-raspbian.img
# Procedure for MacBook Air 13" (Mac OS X 10.8.x) with External HDD
# /dev/disk3s1 is the partition mounted for the SD card.
# /dev/rdisk3 is the actual device block for the SD card.
sudo diskutil unmount /dev/disk3s1
sudo dd bs=1m if=/Volumes/Sonata/Terminal/2012-12-16-wheezy-raspbian.img of=/dev/rdisk3
sudo diskutil eject /dev/rdisk3
@shiroyuki
shiroyuki / gist:4712370
Last active December 12, 2015 04:08
Minimal Setup Script for Python 3.3
#!/usr/bin/sh
echo "Downloading Python 3.3" &&\
rm -Rf python3.3 &&\
mkdir python3.3 &&\
cd python3.3 &&\
curl -O http://python.org/ftp/python/3.3.0/Python-3.3.0.tgz &&\
curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py &&\
curl -O http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz &&\
echo "Extracting packages" &&\
@shiroyuki
shiroyuki / django.vim
Created October 12, 2012 04:45
Django Syntax File for VIM
" Vim syntax file (custom)
" Language: Django template
" Maintainer: Dave Hodder <dmh@dmh.org.uk>
" Last Change: 2010 May 19
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
@shiroyuki
shiroyuki / example-imagination.decorator.validator-20120718.py
Created July 18, 2012 20:24
Example for Imagination's type validator
# This example works with the developmental build of Imagination
from imagination.decorator.validator import restrict_type
# One sad old way of validation
def old_say(context):
assert isinstance(context, unicode) or isinstance(context, str)
print context
# Example on a function