Skip to content

Instantly share code, notes, and snippets.

View mix3's full-sized avatar

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

View GitHub Profile
requires "SQL::Translator::Producer::PlantUML";
requires "DBD::mysql";
@mix3
mix3 / main.go
Last active November 2, 2015 10:39
package main
import (
"log"
"github.com/hashicorp/hcl"
"github.com/k0kubun/pp"
)
type Config struct {
@mix3
mix3 / search.pl
Created September 28, 2015 00:43
括弧の範囲を探すやーつ
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
my $depth = 0;
my $str = "";
while (<>) {
if (/sqlt_deploy_hook\s+\{/) {
#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]
#!/bin/bash -x
# Description:L2TP/IPsec for CentOS7 64bit
# 2015/05/09 @mix3
(
## setting
cat << _SECRETS_ > /tmp/SECRETS_TMP.txt
#==============================================
# username auth_server password auth_ipaddress
@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}"
}

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

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;
#!/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 "$@"
@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 = ();
@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)