Skip to content

Instantly share code, notes, and snippets.

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

t4sk

🏠
Working from home
View GitHub Profile
@t4sk
t4sk / simple_form_mdl_wrappers.rb
Last active November 8, 2016 02:42 — forked from anonymous/simple_form_mdl_wrappers.rb
Material Design Lite (v 1.2.1) wrappers for Simple Form
# Simple wrappers for Material Design Lite text fields to use with SimpleForm (Rails)
SimpleForm.setup do |config|
config.wrappers :mdl_field, tag: 'div', class: 'mdl-textfield mdl-js-textfield', error_class: 'is-invalid' do |b|
b.use :html5
b.use :input, class: 'mdl-textfield__input'
b.use :label, class: 'mdl-textfield__label'
b.use :error, wrap_with: { tag: :span, class: "mdl-textfield__error" }
end
@t4sk
t4sk / bitcoin-tx.md
Last active January 2, 2017 21:25
Bitcoin transaction using bitcoin-qt console

How to create transaction using bitcoin-qt console

  • Example of a transaction with single input and output

Start bitcoin-qt (on testnet)

bitcoin-qt -testnet

Open console

@t4sk
t4sk / dsha256.md
Last active January 8, 2017 23:54
How to compute double sha256

How compute double sha256

This example is from BIP 143 - Native P2WPKH

Compute double sha256

> export PREV_OUTS=fff7f7881a8099afa6940d42d1e7f6362bec38171ea3edf433541db4e4ad969f00000000ef51e1b804cc89d182d279655c3aa89e815b1b309fe287d9b2b55d57b90ec68a01000000
> echo -n $PREV_OUTS | xxd -r -p | openssl dgst -sha256 -binary | openssl dgst -sha256
96b827c8483d4e9b96712b6713a7b68d6e8003a781feba36c31143470b4efd37
@t4sk
t4sk / import-priv-key.md
Last active January 19, 2017 13:49
How to import private key into bitcoin-qt

How to import private key into bitcoin-qt

1. Convert private key to WIF

Click here to covert private key to WIF

In this example

  • private key = 619c335025c7f4012e556c2a58b2506e30b8511b53ade95ea316fd8c3286feb9
  • WIF = 92KuV1Mtf9jTttTrw1yawobsa9uCZGbfpambH8H1Y7KfdDxxc4d
@t4sk
t4sk / regtest.md
Last active December 31, 2017 19:31
How to get bitcoins for development using Regtest

How to get bitcoins for development using Regtest

Start bitcoind

> bitcoind -regtest -daemon

Generate block chain

> bitcoin-cli -regtest generate 101

Keybase proof

I hereby claim:

  • I am t4sk on github.
  • I am t4sk (https://keybase.io/t4sk) on keybase.
  • I have a public key ASBBLtnHpb6we3Je4w_ctTBa7p2XJXl0fDn2Yb9-fi04ggo

To claim this, I am signing this object:

@t4sk
t4sk / Wei.sol
Created March 12, 2019 04:59
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.3+commit.10d17f24.js&optimize=false&gist=
pragma solidity ^0.5.3;
contract Wei {
uint public oneEther = 1 ether;
function test() public pure {
assert(1 ether == 1e18 wei);
assert(1 wei == 1);
}
}
@t4sk
t4sk / segwit-regtest.md
Created December 29, 2016 21:51
How to activate segwit on regtest

How to activate segwit on regtest

Start bitcoind

> bitcoind -regtest -daemon

Generate block chain

> bitcoin-cli -regtest generate 432

Keybase proof

I hereby claim:

  • I am t4sk on github.
  • I am tsknk (https://keybase.io/tsknk) on keybase.
  • I have a public key ASDyZ1hblodO_TVvXYnHmPsWLpqRbYlgG6xzpy0Br_8m7Qo

To claim this, I am signing this object:

@t4sk
t4sk / meaning-of-life.js
Created February 11, 2022 12:56
meaning of life
const Web3 = require("web3");
const assert = require("assert");
const web3 = new Web3();
const email = "email@email.com";
const COLORS = [
"red",
"blue",
"yellow",