Skip to content

Instantly share code, notes, and snippets.

View fkei's full-sized avatar
😀

fkei fkei

😀
View GitHub Profile
@border
border / Makefile
Created January 12, 2011 01:36
json example in golang
include $(GOROOT)/src/Make.inc
GOFMT=gofmt -spaces=true -tabindent=false -tabwidth=4
all:
$(GC) jsontest.go
$(LD) -o jsontest.out jsontest.$O
format:
$(GOFMT) -w jsontest.go
@Integralist
Integralist / errorhandler.js
Created January 12, 2012 09:23
Error Handling with RequireJs
define(function(){
return function(errObject) {
requireType = errObject.requireType;
requireModules = errObject.requireModules.trim().split(' ');
console.log(requireType, requireModules);
};
});
@rore
rore / backup.py
Created March 8, 2012 19:18 — forked from samuel/backup.py
A script to automate freezing XFS and locking MongoDB and snapshotting EBS volumes
#!/usr/bin/env python
from __future__ import with_statement
import contextlib
import logging
import os
import sys
import urllib2
from boto.ec2.connection import EC2Connection
@shigeki
shigeki / test.js
Created May 31, 2012 01:30
socket.io memoryUsage profile with heatbeat by manually gc
var io = require('socket.io').listen(8081);
var parser = require('socket.io').parser;
io.sockets.on('connection', function(socket) {
var pre;
var i = 0;
io.transports[socket.id].parser.on('data', function(p) {
var packet = parser.decodePacket(p);
if(packet.type === 'heartbeat') {
if(global.gc) global.gc();
var memoryUsage = process.memoryUsage();
@fkei
fkei / eventlet_gs_uploader.py
Created July 27, 2012 15:34 — forked from batok/eventlet_gs_uploader.py
A python script to do asynchronous upload to google storage using boto and eventlet libraries
# this program uploads to google storage using boto and eventlet all the jpg files of a selected folder
import eventlet
bcon = eventlet.import_patched("boto.gs.connection")
import glob
FOLDER = "/Users/myself/Documents/" # replace this with your chosen folder
BUCKET_NAME = "whateveryourbucketname" # replace this with your bucket name
def upload(myfile):
c = bcon.GSConnection()
@fkei
fkei / DefaultKeyBinding.dict
Created September 14, 2012 04:04
xcode keybindings for emacs emulation
{
/* Keybindings for emacs emulation. Compiled by Jacob Rus.
*
* To use: copy this file to ~/Library/KeyBindings/
* after that any Cocoa applications you launch will inherit these bindings
*
* This is a pretty good set, especially considering that many emacs bindings
* such as C-o, C-a, C-e, C-k, C-y, C-v, C-f, C-b, C-p, C-n, C-t, and
* perhaps a few more, are already built into the system.
*
@michaelcox
michaelcox / SpecRunner.js
Last active January 11, 2024 06:05
Browser Unit Testing with Backbone Mocha Chai and RequireJS
require.config({
baseUrl: '/backbone-tests/',
paths: {
'jquery' : '/app/libs/jquery',
'underscore' : '/app/libs/underscore',
'backbone' : '/app/libs/backbone',
'mocha' : 'libs/mocha',
'chai' : 'libs/chai',
'chai-jquery' : 'libs/chai-jquery',
'models' : '/app/models'
@hayajo
hayajo / changelog_en.md
Last active July 19, 2024 05:47
ChangeLog を支える英語

ChangeLog を支える英語

ChangeLog を書く際によく使われる英語をまとめました。

ほとんど引用です。

基本形

@mbeale
mbeale / gist:4247971
Created December 10, 2012 02:01
Dynamic JSON sample golang #4
type JSONContainer struct {
data []interface{}
}
func (j *JSONContainer) All() (objects []JSONObject) {
for _, v := range j.data {
objects = append(objects, JSONObject{data: v})
}
return
}
@erning
erning / path.go
Created December 17, 2012 08:26 — forked from sp3c73r2038/path.py
golang
/*
put this script in the path like
assumed /tmp (cwd)
/tmp/dir1/dir2/path.go
/tmp/dir3 symlinked to /tmp/dir1/dir2
and run with
gorun ../tmp/dir3/path.go
or build path.go and run with ../tmp/dir3/path