Skip to content

Instantly share code, notes, and snippets.

View hymkor's full-sized avatar

HAYAMA_Kaoru hymkor

View GitHub Profile
@artyom
artyom / chat.go
Created March 12, 2016 22:06
Example of interactive terminal in Go
package main
import (
"fmt"
"io"
"log"
"os"
"golang.org/x/crypto/ssh/terminal"
)
@yuba
yuba / regex_with_TCHAR.cpp
Created July 31, 2015 07:26
TCHARを使っているC++プロジェクトでC++11正規表現を使おうとするとこういうインクルードをすることになる
#include <regex>
namespace std {
#ifdef _UNICODE
typedef std::wstring tstring;
typedef std::wregex tregex;
typedef std::wsmatch tsmatch;
#else
typedef std::string tstring;
typedef std::regex tregex;
typedef std::smatch tsmatch;
@pine
pine / touch.lua
Created February 12, 2015 10:58
touch command for NYAGOS. License: Public Domain.
nyagos.alias('touch', function(args)
if #args <= 0 then
print 'Usage: touch FILENAME'
return
end
local fd = io.open(args[1])
if fd then
fd:close()
@nocd5
nocd5 / pcd_for_nyagos.lua
Created September 20, 2014 15:43
nyagosでpecoを使ったディレクトリ移動を行う
alias{
pcd = function ()
local line = nyagos.eval("ls -la") -- nyagos組み込みの`ls`
local complst = split(line, "[\r\n]")
local directories = ""
for i, e in ipairs(complst) do
-- 末尾が'/'ならディレクトリって事で決め打ち
if (e:match('.+/$')) then
-- ls -lの結果が
-- <パーミション> <サイズ> <日付> <時間> <ファイル名 or ディレクトリ名>
@echo off
echo LIBRARY mruby.dll > mruby.def
echo EXPORTS >> mruby.def
nm libmruby.a | grep "\ T\ _mrb" | sed s/".*\\ T\\ _"// >> mruby.def
gcc -s -mdll -o mruby.dll mruby.def libmruby.a -Wl,--out-implib,libmruby.dll.a
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@theconektd
theconektd / github.css
Created April 30, 2012 02:11
Github Markdown CSS - for Markdown Editor Preview
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {