Skip to content

Instantly share code, notes, and snippets.

View cubicdaiya's full-sized avatar

Tatsuhiko Kubo cubicdaiya

View GitHub Profile
gem install fpm --no-ri --no-rdoc
# packagesディレクトリ以下をまとめてpackagingする
go build -o YOURAPP yourapp.go
mkdir -p pakcages/usr/local/YOURAPP/{bin,etc}
cp yourapp packages/usr/local/YOUARPP/bin/yourapp
(cd packages; fpm -s dir -t deb -n YOURAPP -v 0.1.0 .)
ls -la packages
  • 大半のgo applicationならdependsはないからfpmはとても楽な選択
@shyouhei
shyouhei / git-strata.rb
Last active December 8, 2019 07:35
This is git-strata, an extended version of git-blame. It takes a path and generates git-blame like output. The difference is, it also shows you how much edits the line experienced.
#! /your/favourite/path/to/ruby
# -*- coding: utf-8 -*-
# Copyright (c) 2013 Urabe, Shyouhei
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
nginx version: nginx/1.5.3
built by gcc 4.6.3 20120306 (Red Hat 4.6.3-2) (GCC)
TLS SNI support enabled
configure arguments:
--prefix=/etc/nginx/
--sbin-path=/usr/sbin/nginx
--conf-path=/etc/nginx/nginx.conf
--error-log-path=/var/log/nginx/error.log
--http-log-path=/var/log/nginx/access.log
--pid-path=/var/run/nginx.pid
@moyashipan
moyashipan / PixivVendorWatcher
Last active December 14, 2015 05:29
カップ式ドリンクベンダー内の「取り出されていないカップ」を監視する。 Arduinoと距離センサを使用。
// 参考にしたソースコード:
// Prototyping Lab ―「作りながら考える」ためのArduino実践レシピ (Make:PROJECTS) [大型本] 小林 茂 (著)
// http://p.tl/RQFE
//
// 使ったArduino(本当はArduino Nano 3.1):
// Arduino Nano
// http://p.tl/1D1u
//
// 使ったセンサを含むキット:
// Prototyping Lab Kit Vol.1 スイッチサイエンス
@Shinpeim
Shinpeim / 000.md
Last active January 22, 2022 07:31
プロセスとかスレッドとかプロセス間通信とかについて書く場所

重要

サイズがあまりに大きくなってしまったので、gist ではなくて github 上で管理するようにしました。

https://github.com/Shinpeim/process-book

URL 変わっちゃうの申し訳ないんだけど、一覧性が高くなるのと pull req が受け取れるメリットのほうを取ります。せっかく読みにきてくれたのにひと手間かかっちゃってすみません。

この文書の目的

@cubicdaiya
cubicdaiya / remote_example.conf
Last active December 10, 2015 23:59
ngx_small_light converts remote image.
# http://example1.jp/small_light(p=small)/img/example.jpgにアクセスが来たら
# http://example2.jp/img/example.jpgの画像を取得&変換して返す
server {
listen 80;
server_name example1.jp;
small_light on;
small_light_pattern_define small dw=150,dh=150,da=l,e=imagemagick,jpeghint=y;
location ~ small_light[^/]*/(.+)$ {
resolver 8.8.8.8;
set $file $1;
@rsky
rsky / cmyk2srgb.php
Created July 10, 2012 13:42
PHP ImagickでCMYK色空間のJPEGファイルをsRGBに変換する
<?php
$im = new Imagick('CMYK.jpg');
$cs = $im->getImageColorspace();
if ($cs !== Imagick::COLORSPACE_RGB && $cs !== Imagick::COLORSPACE_SRGB) {
$icc = null;
try {
$icc = $im->getImageProfile('icc');
} catch (ImagickException $e) {
if ($cs === Imagick::COLORSPACE_CMYK) {
$icc = file_get_contents('JapanColor2001Coated.icc');
@ctdk
ctdk / github.js.diff
Created June 13, 2012 17:39
Diff to fix Octopress' github.js to make it not use the deactivated Github v2 API
diff --git a/source/javascripts/github.js b/source/javascripts/github.js
index 678775a..bc4c9bd 100644
--- a/source/javascripts/github.js
+++ b/source/javascripts/github.js
@@ -3,22 +3,22 @@ var github = (function(){
var i = 0, fragment = '', t = $(target)[0];
for(i = 0; i < repos.length; i++) {
- fragment += '<li><a href="'+repos[i].url+'">'+repos[i].name+'</a><p>'+repos[i].description+'</p></li>';
+ fragment += '<li><a href="'+repos[i].html_url+'">'+repos[i].name+'</a><p>'+repos[i].description+'</p></li>';
@jboner
jboner / latency.txt
Last active May 4, 2024 21:16
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD