Skip to content

Instantly share code, notes, and snippets.

View farukterzioglu's full-sized avatar
🎯
Focusing

Faruk Terzioğlu farukterzioglu

🎯
Focusing
View GitHub Profile
@cimnine
cimnine / Numeric.cs
Created June 25, 2012 16:35
A way to check if a type is numeric in C#
using System;
namespace ch.cimnine.Util
{
public sealed class Numeric
{
/// <summary>
/// Determines if a type is numeric. Nullable numeric types are considered numeric.
/// </summary>
/// <remarks>
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@cristianrasch
cristianrasch / pgp-encryption-guide.md
Last active May 9, 2019 11:28
PGP Encryption Guide

PGP encryption guide

Generating your key pair

gpg --gen-key

echo "export GPGKEY=01086FDA" > ~/.bashrc

There are three easy to make mistakes in go. I present them here in the way they are often found in the wild, not in the way that is easiest to understand.

All three of these mistakes have been made in Kubernetes code, getting past code review at least once each that I know of.

  1. Loop variables are scoped outside the loop.

What do these lines do? Make predictions and then scroll down.

func print(pi *int) { fmt.Println(*pi) }
@TOMOAKI12345
TOMOAKI12345 / bitcoin_spv_wallet_overview.md
Created August 31, 2015 11:37
Bitcoin SPV Wallet Flow Overview

@eliquious
eliquious / README.md
Created January 4, 2016 05:01
Golang OpenPGP examples

Building

go build -o goencrypt main.go

Generating Keys

@vasanthk
vasanthk / System Design.md
Last active May 16, 2024 20:21
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@tomconte
tomconte / compile-deploy-sign.js
Created January 3, 2017 14:25
Shows how to compile and deploy a Smart Contract using client-side transaction signature, i.e. does not require the account to be unlocked in the Ethereum node.
const fs = require('fs');
const solc = require('solc');
const Web3 = require('web3');
const Tx = require('ethereumjs-tx')
// Private key to use to sign the transactions
// To decrypt your private key, use e.g. https://www.myetherwallet.com/#view-wallet-info
// You will find your private key file in e.g. .ethereum/keystore or .parity/keys
// In this example the key should correspond to the web3.eth.coinbase address
var privateKey = new Buffer('088c110b6861b6c6c57461370d661301b29a7570d59cb83c6b4f19ec4b47f642', 'hex')
@patterns
patterns / btcgui-notes.txt
Created February 5, 2017 10:21
Documentation from BtcGui on starting up, and the related cert files.
Linux/BSD/POSIX/Source
Run the following command to start btcd:
$ btcd --testnet -u rpcuser -P rpcpass
Copy btcd's autogenerated rpc.cert to ~/.btcwallet/ so btcwallet can securely communicate with btcd over a TLS-encrypted websocket. This step is only necessary for the first time starting btcwallet or if
btcd's autogenerated cert and key are removed and regenerated.
$ mkdir ~/.btcwallet/
$ cp ~/.btcd/rpc.cert ~/.btcwallet/btcd.cert
@morcos
morcos / FeeEstimationHighLevel.md
Last active June 14, 2023 10:57
Bitcoin Core Fee Estimation Algorithm

High level description Bitcoin Core's fee estimation algorithm

The algorithm takes as input a target which represents a number of blocks within which you would like your transaction to be included in the blockchain. It returns a fee rate that you should use on your transaction in order to achieve this.

The algorithm is conceptually very simple and does not attempt to have any predictive power over future conditions. It only looks at some recent history of transactions and returns the lowest fee rate such that in that recent history a very high fraction of transactions with that fee rate were confirmed in the block chain in less than the target number of blocks.

Transactions can occur with a nearly continuous range of fee rates and so in order to avoid tracking every historical transaction independently, they are grouped into fee rate "buckets". A fee rate bucket represents a range of fee rates within which the algorithm treats all transactions as having approximately the same fee rate and the answer th