Skip to content

Instantly share code, notes, and snippets.

View shogo82148's full-sized avatar
🏠
Working from home

ICHINOSE Shogo shogo82148

🏠
Working from home
View GitHub Profile
//create.go
package gain
import (
"bufio"
"fmt"
"io"
)
@shogo82148
shogo82148 / fizzbuzz.pl
Created April 21, 2018 06:20
PerlとPythonのPolyglot
s="""==;
for (1..100) {
if ($_ % 3 == 0 && $_ % 5 == 0) {
print "fizzbuzz";
} elsif ($_ % 3 == 0) {
print "fizz";
} elsif ($_ % 5 == 0) {
print "buzz";
} else {
print $_;
#!/usr/bin/env perl
use utf8;
use strict;
use warnings;
use Encode qw/encode_utf8 decode_utf8/;
my $against = "HEAD";
if ( system("git rev-parse --verify HEAD >/dev/null 2>&1") != 0 ) {
# Initial commit: diff against an empty tree object
@shogo82148
shogo82148 / const.go
Created October 28, 2017 05:53
const vs var
package main
import (
"fmt"
)
func main() {
const (
x = 0.3
y = 0.2
=== RUN TestConfig__Unmarshal
--- PASS: TestConfig__Unmarshal (0.00s)
=== RUN TestProxySendHandlerFunc__BulkSend
==================
WARNING: DATA RACE
Read at 0x00c420130230 by goroutine 10:
github.com/mackee/kuiperbelt.TestProxySendHandlerFunc__BulkSend()
/Users/shogo/sdk/go1.9beta1/src/bytes/buffer.go:61 +0x115a
testing.tRunner()
/Users/shogo/sdk/go1.9beta1/src/testing/testing.go:754 +0x16c
@shogo82148
shogo82148 / main.go
Created June 5, 2017 04:13
race condition checker for go-mysql-driver
package main
import (
"context"
"database/sql"
"flag"
"fmt"
"log"
"os"
"runtime"
gochaで/a{1,10}/にマッチする文字列を100万個生成
$ gocha -n 1000000 'a{1,10}' | sort | uniq -c
499715 a
249676 aa
125295 aaa
62576 aaaa
31241 aaaaa
15764 aaaaaa
7809 aaaaaaa
3933 aaaaaaaa
#!/bin/bash
FILE=$(git status --short | peco | awk '{print $2}')
if [ $# -eq 0 ]; then
echo "$FILE"
exit 0
fi
git "$@" "$FILE"
@shogo82148
shogo82148 / diff.diff
Last active February 24, 2017 10:03
diff of PDFs in https://shattered.io/
13,20c13,20
< 000000c0 73 46 dc 91 66 b6 7e 11 8f 02 9a b6 21 b2 56 0f |sF..f.~.....!.V.|
< 000000d0 f9 ca 67 cc a8 c7 f8 5b a8 4c 79 03 0c 2b 3d e2 |..g....[.Ly..+=.|
< 000000e0 18 f8 6d b3 a9 09 01 d5 df 45 c1 4f 26 fe df b3 |..m......E.O&...|
< 000000f0 dc 38 e9 6a c2 2f e7 bd 72 8f 0e 45 bc e0 46 d2 |.8.j./..r..E..F.|
< 00000100 3c 57 0f eb 14 13 98 bb 55 2e f5 a0 a8 2b e3 31 |<W......U....+.1|
< 00000110 fe a4 80 37 b8 b5 d7 1f 0e 33 2e df 93 ac 35 00 |...7.....3....5.|
< 00000120 eb 4d dc 0d ec c1 a8 64 79 0c 78 2c 76 21 56 60 |.M.....dy.x,v!V`|
< 00000130 dd 30 97 91 d0 6b d0 af 3f 98 cd a4 bc 46 29 b1 |.0...k..?....F).|
---
echo "I have a pen. I have a apple. ohmosh sakura Apple pen! I have a pen. I have a pineapple. ohmosh sakura Pineapple pen! Apple pen. Pineapplepen. Pen pineapple apple pen." | sed -e "s/\.//g" -e "s/\!//" | tr "[:upper:]" "[:lower:]" | xargs -n1 echo | sort | uniq -c