Skip to content

Instantly share code, notes, and snippets.

View zchee's full-sized avatar
😩
want to Go knowledge...

Koichi Shiraishi zchee

😩
want to Go knowledge...
View GitHub Profile
@zchee
zchee / mac-profiling.md
Created March 7, 2016 08:12 — forked from loderunner/01-mac-profiling.md
Profiling an application in Mac OS X

Profiling an application in Mac OS X

Finding which process to profile

If your system is running slowly, perhaps a process is using too much CPU time and won't let other processes run smoothly. To find out which processes are taking up a lot of CPU time, you can use Apple's Activity Monitor.

The CPU pane shows how processes are affecting CPU (processor) activity:

@zchee
zchee / udp-loader.go
Created March 6, 2016 23:41 — forked from jtblin/udp-loader.go
UDP server performance optimisation
package main
import (
"crypto/rand"
"flag"
"log"
mrand "math/rand"
"net"
"os"
"os/signal"
@zchee
zchee / coverage.sh
Created February 28, 2016 20:16 — forked from adamclerk/coverage.sh
gb coverage script
#!/bin/sh
# Generate test coverage statistics for Go packages.
#
# Works around the fact that `go test -coverprofile` currently does not work
# with multiple packages, see https://code.google.com/p/go/issues/detail?id=6909
#
# Usage: script/coverage [--html|--coveralls]
#
# --html Additionally create HTML report and open it in browser
# --coveralls Push coverage statistics to coveralls.io
@zchee
zchee / profile.py
Created February 16, 2016 09:41 — forked from myusuf3/profile.py
Simple little profiling decorator in python.
import cProfile
def profile_this(fn):
def profiled_fn(*args, **kwargs):
# name for profile dump
fpath = fn.__name__ + '.profile'
prof = cProfile.Profile()
ret = prof.runcall(fn, *args, **kwargs)
prof.dump_stats(fpath)
@zchee
zchee / complete.cc
Created February 15, 2016 21:55 — forked from xavierd/complete.cc
Hacking with libclang completion.
#include <clang-c/Index.h>
#include <cstdlib>
#include <iostream>
/*
* Compile with:
* g++ complete.cc -o complete -lclang -L/usr/lib/llvm
* Run with:
* LIBCLANG_TIMING=1 ./complete file.cc line column [clang args...]
*/
@zchee
zchee / minimal-docker-hosts.md
Created January 22, 2016 12:11 — forked from ailispaw/minimal-docker-hosts.md
メモ:Docker ホスト用軽量OS(30MB以下)の比較
DhyveOS DockerRoot RancherOS Boot2Docker Hyper on Mac (*7)
Version 2.0.0 1.2.8 0.4.2 1.9.1 0.4.0
Size 12 MB 13.7 MB 29 MB 30 MB 4.6 MB
Kernel 4.3.3 4.3.3 4.2.3 4.1.13 4.0.4
User Land Buildroot(uClibc) + BusyBox v1.24.1 Buildroot(GLIBC) + BusyBox v1.24.1 Buildroot(GLIBC) + BusyBox v1.23.2 Tiny Core Linux v6.4.1 -
Docker 1.9.1 1.9.1 1.9.1 1.9.1 -
Storage Driver btrfs overlay overlay (*2) aufs (*2) VDI
TLS - (*9) -
Vagrant box - (v0.4.1) (*3) -
#include <iostream>
void setBackground(unsigned r, unsigned g, unsigned b)
{
std::cout << "\x1b[48;2;" << r << ';' << g << ';' << b << 'm';
}
int main()
{
int point[4][3] = { {255,0,0},
@zchee
zchee / daemon.go
Created December 30, 2015 05:54 — forked from hironobu-s/daemon.go
Goでデーモンを起動する的な
package main
import (
"flag"
"fmt"
"log"
"os"
"os/exec"
"os/signal"
"syscall"
@zchee
zchee / neovim_colorscheme_patcher.rb
Created December 27, 2015 00:50 — forked from metalelf0/neovim_colorscheme_patcher.rb
Neovim colorscheme patcher to add 24bit colors to terminal
#!/usr/bin/env ruby
class VimColorscheme
attr_accessor :file_path
def initialize(file_path)
@file_path = file_path
end
def extract_colors
@zchee
zchee / main.go
Created December 26, 2015 23:02 — forked from Jxck/main.go
interface of Go blog sample
package main
/*
Go のインタフェース設計
参考
https://code.google.com/p/go-wiki/wiki/GoForCPPProgrammers
http://jordanorelli.tumblr.com/post/32665860244/how-to-use-interfaces-in-go
http://research.swtch.com/interfaces
http://www.airs.com/blog/archives/277