Skip to content

Instantly share code, notes, and snippets.

View Code-Hex's full-sized avatar

Kei Kamikawa Code-Hex

View GitHub Profile
@fuba
fuba / shiritori.pl
Created January 2, 2013 16:24
しりとり
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
use Encode;
use YAML::Syck;
use TokyoCabinet;
use Text::KyTea;
use Unicode::Japanese;
@riywo
riywo / gist:879661
Created March 21, 2011 15:49
fork & exec with Perl
use strict;
use warnings;
use IO::Handle;
sub fork_exec {
my @args = @_;
my $handles = [];
if (ref($args[$#args]) eq 'GLOB') {
my $stdin = pop @args;
code="console.log('code='+JSON.stringify(code)+';eval(code)')";eval(code)
@JadenGeller
JadenGeller / Type Inference.c
Created April 29, 2015 03:27
C Type Inference (Let and Var)
#define let(name,value) const __typeof__ (value) name = value;
#define var(name,value) __typeof__ (value) name = value;
int main(int argc, char *argv[]) {
let(x,3); // const int x = 3;
var(y,5); // int y = 5;
printf("x:%i y:%i",x,y); // -> x:3 y:5
}
@kitasuke
kitasuke / StringExtension.swift
Created August 24, 2015 03:19
String extension in Swift for Xcode beta5
extension String {
var lastPathComponent: String {
get {
return (self as NSString).lastPathComponent
}
}
var pathExtension: String {
@jkeroes
jkeroes / perl-memory-modules
Created September 21, 2012 20:28
Perl memory leaks resources
Tracking memory leaks:
Devel::Arena - sv_stats() returns arena structures used for SV allocation
* Devel::Cycle - find_cycle($ref) returns all cycles found in $ref and the perl variables they point to
Devel::Gladiator - walk Perl variable arena
Devel::Leak - deprecated by Devel::LeakTrace::Fast
Devel::LeakTrace - deprecated by Devel::LeakTrace::Fast
* Devel::LeakTrace::Fast - prints leaked SV's and line numbers at END.
Data::Structure::Util - has_circular_ref($ref) returns ref to link in $ref that is circular or false.
Test::LeakTrace - no_leaks_ok(), etc.
@y-ken
y-ken / nginx.conf
Last active November 19, 2019 08:11
流れに乗ってnginxのログフォーマットにLTSVを採用しました。 2013/03/05リリースのfluentd-0.10.32.gemなら標準のin_tailで、format ltsvとする事でそのまま読み込めます。 proxy先からの応答時間や送出したcookieも記録する汎用的な設定です。
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format ltsv 'domain:$host\t'
'host:$remote_addr\t'
'user:$remote_user\t'
'time:$time_local\t'
'method:$request_method\t'
'path:$request_uri\t'
@yoheia
yoheia / perl_oneliner_example
Last active January 24, 2020 18:12
Perlワンライナー&マルチライナー集
Perl ワンライナーサンプル集
■概要
障害解析のためのログの調査、非互換対応でのソースコードの調査といった
テキスト処理で使った Perl ワンライナーのサンプル集です。
Perl ワンライナーは以下の点が良いと思います。
・Perl は Oracle Database (10g以降) に同梱されている。
 従って、Windows プラットフォームでも使える。
@murooka
murooka / perl_first.md
Last active March 10, 2020 23:37
Linuxでのperl環境の構築

perlの環境構築

perlbrewとperlのインストール

何はともあれまずperlbrewを入れる

\curl -L http://install.perlbrew.pl | bash
echo 'source ~/perl5/perlbrew/etc/bashrc' >> .bashrc
source .bashrc

go 1.1 scheduler

where

src/pkg/runtime proc.c asm_*.s

design