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
func findCaller() (*runtime.Frame, string) { | |
// skip starts 6. 0: Callers, 1: findCaller, 2: sqlComment, 3: hooks, 4: proxy-funcs, 5: database/sql, and equals or greater than 6: user-funcs | |
skip := 6 | |
for { | |
var rpc [8]uintptr | |
var i int | |
n := runtime.Callers(skip, rpc[:]) | |
frames := runtime.CallersFrames(rpc[:]) | |
for i = 0; ; i++ { | |
frame, more := frames.Next() |
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
<?php | |
$date_str = '2017-07-25T15:26:16.12+02:00'; | |
$date_str = preg_replace('/^(\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2})(?:(\\.\\d{6})\\d*)?(.*)/', '$1$2$3', $date_str); | |
$d = DateTime::createFromFormat("Y-m-d\TH:i:s.uP", $date_str); | |
var_dump($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
#!/usr/bin/env perl | |
use 5.014; | |
use warnings; | |
use utf8; | |
use autodie; | |
use Time::HiRes qw/gettimeofday tv_interval/; | |
# you need `ghg` command to work it | |
my $workdir = '.tmp'; | |
my $trial = 100; |
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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Data::Dumper; | |
use HTTP::Tiny; | |
use Encode qw/decode_utf8/; | |
use JSON::PP qw/encode_json decode_json/; | |
my $access_token = $ENV{PUSHBULLET_TOKEN}; |
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
#!/bin/sh | |
export LANG=ja_JP.UTF-8 | |
export LC_ALL=ja_JP.UTF-8 | |
words=$(cat /path/to/*.md | wc -m) | |
echo "writing.chars.hogehoge $words " $(date +%s) |
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
#!/usr/bin/env perl | |
use 5.014; | |
use warnings; | |
use Encode qw/decode_utf8 encode_utf8/; | |
use Unicode::Normalize qw/NFC/; | |
use File::Basename qw/basename dirname/; | |
use File::Copy qw/move/; | |
use File::Spec; | |
for my $file (@ARGV) { |
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
#!/bin/bash | |
# snow.bash $(date +%s) | |
set -e | |
epoch=$1 | |
if ! [[ $epoch =~ ^([0-9]+)$ ]]; then | |
echo 'Error: valid epoch required' | |
echo "Usage: $0 \$epoch" | |
exit 1 | |
fi | |
echo $(($(expr $epoch \* 1000 - 1288834974657) << 22)) |
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
#!/usr/bin/env perl | |
use 5.014; | |
use warnings; | |
use utf8; | |
use autodie; | |
use JSON::PP qw/encode_json/; | |
my $os = shift || 'darwin'; | |
my $cmd = { | |
darwin => 'brew list --versions', |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Mackerel Graph Builder</title> | |
<script src="https://cdn.jsdelivr.net/lodash/4.13.1/lodash.min.js"></script> | |
<script type="text/javascript"> | |
var $ = function(id) { | |
return document.getElementById(id) | |
}; |
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
runtime: garbage collector found invalid heap pointer *(0xc08207e720+0x18)=0xf s=nil | |
runtime: found *(0xc082043988+0x8) = 0xc08207e720+0x0 | |
fatal error: bad pointer | |
runtime stack: | |
runtime.throw(0x918359) | |
c:/go/src/runtime/panic.go:491 +0xad fp=0x2aef9e8 sp=0x2aef9b8 | |
scanblock(0xc082043988, 0x128, 0x813714) | |
c:/go/src/runtime/mgc0.c:415 +0x990 fp=0x2aefb28 sp=0x2aef9e8 | |
scanframe(0x2aefc30, 0x0, 0x101) |
NewerOlder