Skip to content

Instantly share code, notes, and snippets.

View mix3's full-sized avatar

mix3@サタデーナイトフィーバー mix3

View GitHub Profile
@mix3
mix3 / gist:3fe98045dc4e4b65b8bc
Created December 17, 2014 08:59
Const::Common 上書きできるかな?

$ cat lib/App/Const.pm

package App::Const;

use Const::Common( HOGE => 10, );

1;

$ cat t/test.t

@mix3
mix3 / chanked_client.go
Created January 6, 2015 14:30
チャンクで返すサーバと、それを受けるクライアント
package main
import (
"bufio"
"fmt"
"log"
"net/http"
"net/http/httputil"
"os"
)
@mix3
mix3 / runtime.stack.parse.go
Last active August 29, 2015 14:13
runtime.StackからgoroutineIDを取得する
package main
import (
"log"
"runtime"
"sync"
)
func goroutineId() string {
buf := make([]byte, 1024)
@mix3
mix3 / zoi_urls.pl
Created January 22, 2015 07:24
http://zoi.herokuapp.com/ から画像urlのリストを取ってくる
use 5.018;
use strict;
use warnings;
use utf8;
use Furl;
sub zoi_urls {
state $urls = do {
my $furl = Furl->new;
my @urls = ();
#!/bin/bash
LIB_DIR=~/.plenv/libs
PERL_VERSION=`plenv version | awk -v ORS='' '{print $1}'`
SS_DIR=`ls -alh $LIB_DIR | grep $PERL_VERSION | grep start_server | awk '{print $NF}'`;
SS_LIB=$LIB_DIR/$SS_DIR
if [ -e $SS_LIB ]; then
eval $(perl -Mlocal::lib=$SS_LIB)
start_server "$@"

例えばこういうのがあって

CREATE TABLE sample (
  id      BIGINT  unsigned NOT NULL auto_increment,
  type    TINYINT unsigned NOT NULL DEFAULT 0,
  body    TEXT             NOT NULL,
  is_read TINYINT unsigned NOT NULL DEFAULT 0,
  primary key (id)
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4;
@mix3
mix3 / gist:27f0e7f593aacd9787e7
Last active August 29, 2015 14:16
Data::Dumperで出力したやつの文字列を無理やり変換する
$ perl -MData::Dumper -e 'use utf8; local $Data::Dumper::Purity = 1; local $Data::Dumper::Terse = 1; local $Data::Dumper::Deepcopy = 1; local $Data::Dumper::Quotekeys = 0; local $Data::Dumper::Sortkeys = 1; print Dumper { "あ" => "い", "う" => "え" };'
{
  "\x{3042}" => "\x{3044}",
  "\x{3046}" => "\x{3048}"
}
#cloud-config
write_files:
- path: /var/lib/iptables/rules-save
permissions: 0644
owner: root:root
content: |
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
@mix3
mix3 / vimrc
Created October 14, 2010 06:00
" vim:set ts=8 sts=2 sw=2 tw=0: (この行に関しては:help modelineを参照)
"
" An example for a Japanese version vimrc file.
" 日本語版のデフォルト設定ファイル(vimrc) - Vim7用試作
"
" Last Change: 24-Jul-2007.
" Maintainer: MURAOKA Taro <koron@tka.att.ne.jp>
"
" 解説:
" このファイルにはVimの起動時に必ず設定される、編集時の挙動に関する設定が書
@mix3
mix3 / symfony_completion_generate.pl
Created February 6, 2011 09:48
./symfony | perl symfony_competion_generate.pl > /etc/bash_completion.d/symfony
#!/usr/bin/perl
use strict;
use warnings;
my ($first, @cmd);
while ( <> ) {
if ( /^([a-zA-Z0-9\-]+)/ ) {
$first = $1;
} elsif ( /^\s*(:[a-zA-Z0-9\-]+)/ ) {