Skip to content

Instantly share code, notes, and snippets.

View kafaichoi's full-sized avatar
🍃

KaFai kafaichoi

🍃
View GitHub Profile
if (fGenerateBitcoins)
if (_beginthread(ThreadBitcoinMiner, 0, NULL) == -1)
printf("Error: _beginthread(ThreadBitcoinMiner) failed\n");
@kafaichoi
kafaichoi / bitcoin_miner-1.cpp
Created August 25, 2019 12:37
BitcoinMiner - 1
bool BitcoinMiner()
{
printf("BitcoinMiner started\n");
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_LOWEST);
CKey key;
key.MakeNewKey();
CBigNum bnExtraNonce = 0;
while (fGenerateBitcoins)
{
@kafaichoi
kafaichoi / keybase.md
Created November 20, 2018 13:30
keybase.md

Keybase proof

I hereby claim:

  • I am bruteforcecat on github.
  • I am bruteforcecat (https://keybase.io/bruteforcecat) on keybase.
  • I have a public key ASAC5RtBzNL8gdSslj8QZmTJSKvBzEsh1SwOkJMgU69_iQo

To claim this, I am signing this object:

@kafaichoi
kafaichoi / vim.md
Last active April 23, 2018 02:54
Productivity
@kafaichoi
kafaichoi / learning-clojure.md
Created September 14, 2017 06:38
Learning Clojure

Ring

  • Adapater Http Request -> Ring Request Ring Resposne -> Http Response
  • Handler Ring Request -> Http Response Basically clojure function
(defn handler [req]
  {:status: 200
@kafaichoi
kafaichoi / elixir-phoenix-note.md
Last active August 25, 2017 10:19
Elixir Phoenix Note

Elixir = Ruby + Erlang + Clojure

Ruby: Developer Happiness Erlang: OTP Powerful Clojure: One of the best designed language. Elixir: Programmer focused, functional but pragmatic, standard toolset

Elixir Design priniciples

  1. Phoenix is not our application. Phoenix 1.3 is just web interface.
  2. Embrace state outside of the database. process holding state. OK to have stateful server
  3. If it's concurrent, extract it into an OTP application.
- install kerl
- install wxmac `brew install wxmac`
- add ~/.kerlrc `echo "KERL_CONFIGURE_OPTIONS="--disable-debug --without-javac --enable-shared-zlib --with-ssl=/usr/local/opt/openssl --enable-hipe --enable-smp-support --enable-threads --enable-kernel-poll --with-wx"" > ~/.kerlrc`
- kerl build 20.0 20.0
- kerl install 20.0 ~/erlang/erlang_20_0
- add this `~/erlang/erlang_20_0` to ~/.zshrc
@kafaichoi
kafaichoi / note-elixir-otp-abstraciton.md
Created August 16, 2017 05:10
Note on Elixir New OTP Abstraction

Process

Process is the concurrency primitive in ErlangVM To have State, we need server process which basically a recursive function call to keep it alive.

Agent

Simple wrapper around state. Keep state.

{:ok, agent} = Agent.start_link fn -> [] end
## Way of presenting idea
- Flowcharts
- Pseudocode
- Math Model
## Complexity
Time Complexity.
Memory Complexity
## Strategy
@kafaichoi
kafaichoi / haskell-programming-book-note.md
Last active August 6, 2017 10:00
Haskell Programming

Ch14 Testing

Unit Testing & Propoerty Testing

Property Testing

Propety tests test the formal propoerties of programs.

Ch15 Monoid

In Haskell, we recognize abstract pattern in code which have well-defined, lawful representation in math. These abstractions is described as algebra, by which we mean operations and the set(the type they operate on) they operate over.