Skip to content

Instantly share code, notes, and snippets.

View hideo55's full-sized avatar

Hideaki Ohno hideo55

View GitHub Profile
@hideo55
hideo55 / FindSSE.cmake
Created May 24, 2013 11:35
CMake module that detect SSE support
# Check if SSE instructions are available on the machine where
# the project is compiled.
MACRO (FindSSE)
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
EXEC_PROGRAM(cat ARGS "/proc/cpuinfo" OUTPUT_VARIABLE CPUINFO)
STRING(REGEX REPLACE "^.*(sse2).*$" "¥¥1" SSE_THERE ${CPUINFO})
STRING(COMPARE EQUAL "sse2" "${SSE_THERE}" SSE2_TRUE)
@hideo55
hideo55 / digest_pp
Created June 17, 2013 05:55
Benchmark test of pure perl Digest::* implementation.
Rate sha md5 murmur3
sha 808/s -- -92% -92%
md5 10000/s 1138% -- -2%
murmur3 10204/s 1163% 2% --
/* NO-OP for little-endian platforms */
#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__)
# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
# define BYTESWAP(x) (x)
# endif
/* if __BYTE_ORDER__ is not predefined (like FreeBSD), use arch */
#elif defined(__i386) || defined(__x86_64) \
|| defined(__alpha) || defined(__vax)
# define BYTESWAP(x) (x)
@hideo55
hideo55 / metacpan_fav.pl
Last active December 14, 2015 15:09
metacpan fav search
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use JSON;
use Furl;
use constant {
METACPAN_URL => 'http://api.metacpan.org',
API_FAV => '/v0/favorite/_search?q=distribution:',
API_USER => '/v0/author/_search?q=user:',
@hideo55
hideo55 / metacpan_fav.md
Last active December 14, 2015 15:08
metacpanで++er逆引き
var spawn = require('child_process').spawn;
var ls = spawn('bash',['-c','ls','/*']);
ls.stdout.on('data', function(data){
console.log(data.toString());
});
let ff_table = {'dos' : 'CR+LF', 'unix' : 'LF', 'mac' : 'CR' }
set statusline=%F%m%r%h%w\ [%Y][%{ff_table[&ff]}][%{&fileencoding}]
" %{ff_table[&ff]} で改行コード表示
" %{&fileencoding} で文字エンコーディング表示
a = Hash[ *(<<EOS.split("\n").map {|e| [e,true]}.flatten()) ]
foo
bar
baz
EOS
p a # => {"foo"=>true, "bar"=>true, "baz"=>true}
@hideo55
hideo55 / heredoc.rb
Created July 17, 2012 11:27
Ruby here document
h = {
hoge: <<EOS,
Hey!
EOS
fuga: <<EOS
Yo!
EOS
}
p h
@hideo55
hideo55 / gist:2312264
Created April 5, 2012 16:15
Hachioji.pmで作るYet another IRCについての設計案

AP

  • サーバサイドはとにかくAPIに徹する感じ
  • レンダリングはクライアントで

フロント