Skip to content

Instantly share code, notes, and snippets.

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

serinuntius serinuntius

🏠
Working from home
View GitHub Profile
@serinuntius
serinuntius / nenri.rb
Created May 22, 2019 11:36
複利シミュレーション まめた用
print("貯金する額は?\n")
chokin = gets.to_i
print("年利は何%?\n")
nenri = gets.to_i / 100.0
print("何年貯金する?\n")
year = gets.to_i
sum = chokin
@serinuntius
serinuntius / index.js
Last active November 6, 2018 11:52
firebaseとexpressの最小構成サンプル(?)
const functions = require('firebase-functions');
const express = require("express");
const app = express();
app.get('/hoge', (req, res) => {
res.send('hoge')
});
@serinuntius
serinuntius / unity-asset-size.rb
Created September 20, 2018 01:51
unityのassetをいい感じにグルーピングして、ファイルサイズ出してくれるやつ
ls_results = `ls -alh`.split("\n")
regex = /([\w*(-|)]*\.unity3d$)/
def find_group(file_name)
regex2 = /([\w_]*)[_|-][\d\w]*.unity3d$/
regex2.match(file_name)
end
@serinuntius
serinuntius / read-ruby-lib.md
Last active August 28, 2018 04:44
Rubyのコードのリーディングをして、どうすればoptionのscopeを変更できるか調べてみる。

調査の仕方のメモ

変更したい対象となるクラスをまず読む

ここでoptionというメソッドが呼ばれている。 https://github.com/kazasiki/omniauth-line/blob/master/lib/omniauth/strategies/line.rb#L8

どこで定義されているメソッドかわからないので、継承してるクラス(OmniAuth::Strategies::OAuth2)を調べてみる。

OmniAuth::Strategies::OAuth2を読む

https://github.com/omniauth/omniauth-oauth2/blob/master/lib/omniauth/strategies/oauth2.rb#L23-L31

@serinuntius
serinuntius / litchee2todaystask.js
Created August 9, 2018 01:27
ライチのreadyに入れたタスクをtodaystaskに変換してくれるブックマークレット
javascript: (() => {
const b = document.getElementsByClassName('board')[1];
const t = b.getElementsByClassName('task-card_desc_title');
const tasks = Array.prototype.map.call(t,e => `- ${e.innerText}`);
const template = `
*1.今日は何をする予定ですか?*\n
${tasks.join('\n')}\n
*2.予定より遅延している作業はありますか?*\n\n
*3.その他、何か困っていることや伝えたいことはありますか?*\n\n
@serinuntius
serinuntius / main.go
Created July 20, 2018 04:39
GitHubのIssueのページネーションに対応した、画像ダウンロードスクリプト
// zshなら
// read -s 'TOKEN?tokenを入れてください>'
// go run main.go | xargs wget
package main
import (
"context"
"fmt"
"os"
"regexp"
@serinuntius
serinuntius / request.log
Created May 12, 2018 14:28
graqtのログ
{"level":"info","ts":1525134349.9798086,"caller":"graqt/middleware.go:25","msg":"","time":0.013506292,"request_id":"d8523ba8-9948-4171-90ae-57f3b4649efa","path":"/user","method":"GET"}
{"level":"info","ts":1525134349.9832635,"caller":"graqt/middleware.go:25","msg":"","time":0.016754381,"request_id":"378cfdee-08cd-477b-8f5b-eeeb06a1f6ce","path":"/user","method":"GET"}
{"level":"info","ts":1525134349.9837048,"caller":"graqt/middleware.go:25","msg":"","time":0.017091545,"request_id":"fe339125-8bf9-4520-9b04-18a0cf6a36e2","path":"/user","method":"GET"}
{"level":"info","ts":1525134349.9851286,"caller":"graqt/middleware.go:25","msg":"","time":0.018650912,"request_id":"4dba585a-6aa4-4a6e-8256-92211918f0ff","path":"/user","method":"GET"}
{"level":"info","ts":1525134349.9884024,"caller":"graqt/middleware.go:25","msg":"","time":0.022164821,"request_id":"b811da33-261f-4a68-b8f3-660a1a10126a","path":"/user","method":"GET"}
{"level":"info","ts":1525134349.9896631,"caller":"graqt/middleware.go:25","msg":"","time":0.0232224
@serinuntius
serinuntius / json_test.go
Last active May 12, 2018 14:28
JSONのログをパースするベンチマーク
package graqt
import (
"testing"
)
import (
"bufio"
"bytes"
"encoding/json"
@serinuntius
serinuntius / install.sh
Created March 6, 2018 14:20
kuiperbeltインストール失敗のログ
$ go get github.com/mackee/kuiperbelt/cmd/ekbo
# github.com/mackee/kuiperbelt/cmd/ekbo
src/github.com/mackee/kuiperbelt/cmd/ekbo/main.go:32:44: cannot use agent.Options literal (type *agent.Options) as type agent.Options in argument to agent.Listen
@serinuntius
serinuntius / uranai.json
Created January 30, 2018 00:45
めざまし占い(2016/5/12~2018/1/23)の占い結果 http://mezamashi-uranai.herokuapp.com/ の dump結果
[{"id":2,"rank1":"うお座","rank2":"さそり座","rank3":"かに座","rank4":"おとめ座","rank5":"おうし座","rank6":"やぎ座","rank7":"ふたご座","rank8":"てんびん座","rank9":"みずがめ座","rank10":"いて座","rank11":"しし座","rank12":"おひつじ座","created_at":"2016-05-12T01:48:29.927+09:00","updated_at":"2016-05-12T01:48:29.927+09:00"},{"id":3,"rank1":"しし座","rank2":"おひつじ座","rank3":"みずがめ座","rank4":"てんびん座","rank5":"ふたご座","rank6":"いて座","rank7":"かに座","rank8":"うお座","rank9":"さそり座","rank10":"やぎ座","rank11":"おとめ座","rank12":"おうし座","created_at":"2016-05-12T08:00:35.132+09:00","updated_at":"2016-05-12T08:00:35.132+09:00"},{"id":4,"rank1":"ふたご座","rank2":"てんびん座","rank3":"しし座","rank4":"いて座","rank5":"おひつじ座","rank6":"みずがめ座","rank7":"おとめ座","rank8":"さそり座","rank9":"うお座","rank10":"おうし座","rank11":"かに座","rank12":"やぎ座","created_at":"2016-05-13T08:00:37.734+09:00","updated_at":"2016-05-13T08:00:37.734+09:00"},{"id":7,"rank1":"かに座","rank2":"さそり座","rank3":"おとめ座","rank4":"おうし座","rank5":"やぎ座","rank6":"うお座","rank7":"しし座","rank8":"みずがめ座","rank9":"いて座","rank10":"ふたご座","rank11":"てんびん座","rank12":"お