Skip to content

Instantly share code, notes, and snippets.

@shiwork
shiwork / math.exs
Created May 26, 2015 09:01
elixir
defmodule Math do
def sum_list([head|tail]) do
sum_list(tail, head)
end
def sum_list([head|tail], accumulator) do
sum_list(tail, head + accumulator)
end
def sum_list([], accumulator) do
@shiwork
shiwork / appsscript.json
Last active April 7, 2021 11:10
Bybitの資産残高をGASで取り込むためのScript
{
"timeZone": "Asia/Tokyo",
"dependencies": {},
"exceptionLogging": "STACKDRIVER",
"runtimeVersion": "V8"
}
@shiwork
shiwork / erros.go
Created September 11, 2020 11:17
Handling row not found error from spanner and yo package
package errors
import (
"regexp"
"cloud.google.com/go/spanner"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
@shiwork
shiwork / mydns.lua
Created March 7, 2016 23:19
YAMAHA RTXシリーズでDDNSをLuaで更新通知するスクリプト
------------------------------------
-- Config
------------------------------------
-- MyDNS ID
mid="MyDNSID"
-- MyDNS Password
pwd="MyDNSPASSWD"
@shiwork
shiwork / silent_kill.php
Last active November 11, 2016 17:40
silent kill
<?php
/**
* Class SilentKill
*
* @method $this echo()
* @method $this process()
*/
class SilentKill{
@shiwork
shiwork / speedtest.sh
Created March 18, 2016 05:55
回線速度をいい感じに計測する的な
speedtest --list | grep Japan | head -n 3 | sed 's/\([^)]*\).*$/\1/' | xargs -ISERVER_ID speedtest --server SERVER_ID --simple
@shiwork
shiwork / gist:8563093
Created January 22, 2014 17:28
tsファイルまとめて削除
find ./ -mtime +10 -name "*.ts" -type f -maxdepth 1 | xargs rm
@shiwork
shiwork / gist:8563016
Created January 22, 2014 17:24
tsファイルまとめて削除
find ./ -mtime +10 -name "*.ts" -type f -maxdepth 1 | xargs
@shiwork
shiwork / gist:8519597
Last active January 3, 2016 21:09
木戸衣吹ちゃんのマガジン読書会
@shiwork
shiwork / FileReflector.php
Last active December 27, 2015 13:29
phpDocumentor2で日本語が扱えない問題の修正。 対象のファイルの文字コードに合わせて変換したいが、php.iniのlanguageやらmb_languageに依存するみたい。
/**
* Opens the file and retrieves its contents.
*
* During construction the given file is checked whether it is readable and
* if the $validate argument is true a PHP Lint action is executed to
* check whether the there are no parse errors.
*
* By default the Lint check is disabled because of the performance hit
* introduced by this action.
*