Skip to content

Instantly share code, notes, and snippets.

@yhirano
yhirano / ThinkPad T14 Gen1 (AMD)にUbuntu 20.10をインストールした際のメモ.md
Last active February 8, 2021 15:55
ThinkPad T14 Gen1 (AMD)にUbuntu 20.10をインストールした際のメモ
#!/usr/bin/env python2
from zbase32 import zbase32
import hashlib
import sys
input = sys.argv[1]
print "hashing " + input
m = hashlib.sha1()
m.update(input)
@youkinjoh
youkinjoh / extendJSON.md
Last active March 9, 2022 07:37
JSONが対応していない値(NaN/Infinity/Date等)をJSONに保存する方法

JSONが対応していない値をJSONに保存する方法

JSONは NaN / Infinity / -InfinityDate 型等に対応していない。 しかし、JavaScriptのJSONは、これらを解消する仕組みを持っている。 それは JSON.parse の第二引数の reviverJSON.stringify の第二引数の replacer だ。

注意が必要なのは、 Date 型は toJSON メソッドを持つため replacer に値が渡る前に文字列になってしまうこと。 これに対応するには toJSON メソッドを一時退避してしまえば良い。

これらを上手く駆使すれば、JSONに型を保ったまま値を保存し復元することができる。

@guchimon99
guchimon99 / convert-profit-coincheck.js
Created December 1, 2017 03:54
利益計算用取引所別スクリプト coincheck
var fs = require('fs')
const
PATH_SELLS = __dirname + "/../files/coincehck/buys-2017-11-30.csv",
PATH_BUYS = __dirname + "/../files/coincehck/sells-2017-11-30.csv"
var sellsCsv = fs.readFileSync(PATH_SELLS, 'utf-8'),
buysCsv = fs.readFileSync(PATH_BUYS, 'utf-8')
var result = {}
@guchimon99
guchimon99 / convert-profit-zaif.js
Created December 1, 2017 03:53
利益計算用取引所別スクリプト zaif
var fs = require('fs')
const
PATH_CURRENCY = "path/to/trade_log.csv",
PATH_TOKEN = "path/to/token_trade_log.csv"
var currencyCsv = fs.readFileSync(PATH_CURRENCY, 'utf-8'),
tokenCsv = fs.readFileSync(PATH_TOKEN, 'utf-8')
var result = {}
01000000 - version
0000000000000000000000000000000000000000000000000000000000000000 - prev block
a64bac07fe31877f31d03252953b3c32398933af7a724119bc4d6fa4a805e435 - merkle root
f083c252 - timestamp
f0ff0f1e - bits
66d61200 - nonce
01 - number of transactions
01000000 - version
01 - input
0000000000000000000000000000000000000000000000000000000000000000ffffffff - prev output
@nogajun
nogajun / wine-japanese.reg
Last active December 18, 2023 12:12
LinuxのWine環境で日本語周りをいい感じに設定するレジストリデータ。Windowsで使われるフォント名置換とビットマップフォント無効、InputStyleをrootにします
Windows Registry Editor Version 5.00
' 文字コードをUTF-16リトルエンディアン、改行をCR+LFで保存してください
[HKEY_CURRENT_USER\Software\Wine\Fonts\Replacements]
"Meiryo UI"="Noto Sans CJK JP"
"Meiryo"="Noto Sans CJK JP"
"MS Gothic"="Ume Gothic"
"MS Mincho"="Ume Mincho"
"MS PGothic"="Ume P Gothic"
## monacoin.confの内容
rpcuser=wakiyamatamamichankawaii
rpcpassword=[適当にパスワードどうぞ]
daemon=1
txindex=1
addressindex=1
spentindex=1
server=1
@hyuki0000
hyuki0000 / TipmonaTipBookmarklet.js
Last active January 19, 2018 22:46
TipmonaTipBookmarklet.js - Pay monacoin via @tipmona
/*
* TipmonaTipBookmarklet.js
*
* When you see
* https://twitter.com/EXAMPLEUSER/...
* Then you jump to
* https://twitter.com/intent/tweet?text=@tipmona%20tip%20@EXAMPLEUSER%201%20Mona%20を贈ります。
* And when you see
* https://twitter.com/EXAMPLEUSER/status/xxxxxxxx
* Then you jump to
@sstone
sstone / eclair-ltc-demo.md
Last active June 22, 2019 06:53
Setting up eclair on Litecoin testnet

Running eclair on Litecoin

We need:

  • A fully synchronized Litecoin node on testnet, with Zmq notifications enabled (this is easily available on Linux only at the moment)
  • Our Lightning Node, eclair, which you can get there: https://github.com/ACINQ/eclair

We then create 3 directories for our eclair node, create an eclair.conf configuration file in each data directory, and all we need to change are the connections ports (so they can connect to the Litecoin client) and the fee rate (so that our opening/closing transactions will be relayed by the Litecoin client). And that’s it ! You can even see in the video that labels are still in BTC/milliBTC.

We then connected A to B, B to C, waited for all funding transactions to be confirmed and all channels announced, made a few payments, closed all channels and waited again for all closing transactions to be confirmed.