Skip to content

Instantly share code, notes, and snippets.

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

Kengo Nakajima kengonakajima

🏠
Working from home
View GitHub Profile
local ffi = require("ffi")
ffi.cdef[[
typedef long time_t;
typedef struct timeval {
time_t tv_sec;
time_t tv_usec;
} timeval;
int gettimeofday(struct timeval* t, void* tzp);
@kengonakajima
kengonakajima / gfm2html.md
Created December 26, 2016 03:30 — forked from t-nissie/gfm2html.md
手もとでGFMファイルをHTMLファイルに変換する簡単なRubyスクリプトgfm2html.rb

gfm2html.rb

手もとでGFM (GitHub Flavored Markdown) ファイルをHTMLファイルに変換する簡単なRubyスクリプトgfm2html.rbを下に置きました。 github-markdownを用いています。 google-code-prettifyを使えばsyntax highlightができることが特徴です。 簡単なCSSファイルを用意して使います。例としてstyle.cssが下に置いてあります。

この文章は Gist https://gist.github.com/t-nissie/c415b7da3a694e82d6b5 に置いてあります。 git clone [email protected]:c415b7da3a694e82d6b5.git gfm2htmlでクローンできます。

@kengonakajima
kengonakajima / mcprotos_list.md
Created May 31, 2017 08:44 — forked from rom1504/mcprotos_list.md
List of files representing the minecraft protocol
@kengonakajima
kengonakajima / git-branches-by-commit-date.sh
Created February 16, 2018 05:56 — forked from l15n/git-branches-by-commit-date.sh
List remote Git branches and the last commit's author and author date for each branch. Sort by most recent commit's author date.
# Credit http://stackoverflow.com/a/2514279
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ai %ar by %an" $branch | head -n 1` \\t$branch; done | sort -r
@kengonakajima
kengonakajima / EchoServer.py
Created June 21, 2022 20:02 — forked from limingzju/EchoServer.py
A simple Python echo server, show how to write socket program use python.
# Echo server program
import socket
HOST = '' # Symbolic name meaning all available interfaces
PORT = 50007 # Arbitrary non-privileged port
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((HOST, PORT))
s.listen(1)
conn, addr = s.accept()
(function() {
var debug = false;
var root = this;
var EXIF = function(obj) {
if (obj instanceof EXIF) return obj;
if (!(this instanceof EXIF)) return new EXIF(obj);
this.EXIFwrapped = obj;