This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"strings" | |
"time" | |
) | |
const ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"strconv" | |
"testing" | |
) | |
var columns = []string{"a", "b", "c", "d", "e", "f"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
{ | |
package Simple; | |
sub foo { 1 } | |
} | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use utf8; | |
use 5.012; | |
my ($path, $date) = @ARGV; | |
my @files = map {chomp $_; $_}split /\n/, `git ls-files $path`; | |
for my $file (@files) { | |
my $updated = `git log -n1 --format="%aI" $file`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use utf8; | |
use 5.012; | |
sub parse_email { | |
my $email = shift; | |
my $pos = rindex($email, "@"); | |
return (substr($email, 0, $pos), substr($email, $pos + 1)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"flag" | |
"fmt" | |
"log" | |
"net/http" | |
"os" | |
"strings" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use Benchmark qw(:all); | |
use DateTime; | |
my $now = DateTime->now(); | |
my $last = $now->clone->subtract(minutes => 10); | |
my $now_epoch = scalar time(); | |
printf "%s\n", $now->strftime('%Y%m%d'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
isu1$ rsync -avr isu{1..4}:/etc/mysql ~/repo/etc/isu{1..4}/ | |
isu1$ rsync -avr isu{1..4}:/etc/nginx ~/repo/etc/isu{1..4}/ | |
isuN$ sudo rm /etc/nginx/nginx.conf && ln -s ~/repo/etc/isuN/nginx/nginx.conf /etc/nginx/nginx.conf | |
isuN$ sudo rm /etc/nginx/sites-enabled/cco.nginx.conf && ln -s ~/repo/etc/isuN/nginx/sites-available/cco.nginx.conf /etc/nginx/sites-enabled/cco.nginx.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test | |
import "reflect" | |
func SliceEqualBy(slice interface{}, checkFun func(i int) bool) bool { | |
rv := reflect.ValueOf(slice) | |
for i := 0; i < rv.Len(); i++ { | |
if !checkFun(i) { | |
return false | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test | |
import "reflect" | |
func SliceEqualBy(slice interface{}, checkFun func(i int) bool) bool { | |
rv := reflect.ValueOf(slice) | |
for i := 0; i < rv.Len(); i++ { | |
if !checkFun(i) { | |
return false | |
} |