Skip to content

Instantly share code, notes, and snippets.

View Piliponful's full-sized avatar
💭
I'm doing nothing on github

piliponful Piliponful

💭
I'm doing nothing on github
View GitHub Profile
@gavinandresen
gavinandresen / UTXO_Cuckoo.md
Last active June 7, 2021 17:45
Using a cuckoo filter for fast 'unspent?' lookups

A "Cuckoo Filter" is a nifty data structure invented a few years ago; read the paper for details.

Like a Bloom filter, you insert items and then can later ask "does this item exist in the filter?" You'll get either a definite "no" or "yes, probably" with some false-positive error rate. Cuckoo filters have two advantages over Bloom filters:

  1. They are more space efficient at false positive rates less than about 0.03.
  2. You can delete items from them without affecting the false positive rate at all.

It seems to me that an in-memory cuckoo filter could work really well to keep track of Bitcoin's "unspent transaction output set" (UTXO set), to make transaction (or block) validation as fast as possible using minimal memory or disk.

Recall that Bitcoin transactions (other than coinbase transactions that create new coins) have inputs that refer to unspent outputs. An input refers to a previous output by giving the transaction id (a 32-byte hash) co

@evertonfraga
evertonfraga / delegatecall.sol
Last active December 19, 2017 03:01
Prevent library direct code execution
/**
This code snippet aims to show how to prevent library methods from being executed directly.
That's achieved by baking in the address of the library before it's deployed, then comparing `address(this)` against the saved address within a modifier.
A contract/library address is deterministic, so one could inject that in: keccak256(creator_address, nonceValue).
Thanks to @pirapira, @chriseth and @arachnid for the idea.
*/
@evertonfraga
evertonfraga / ethereum-dev-mode.md
Last active June 22, 2022 11:55
Set up an Ethereum development network in two minutes
@i-am-tom
i-am-tom / Main.purs
Created March 29, 2017 06:41
Wolfram's Rule 30 cellular automaton in PureScript.
module Main where
import Prelude
import Control.Comonad (class Comonad, class Extend, extend, extract)
import Control.Monad.Eff.Console (log)
import Data.Array ((..), (!!), cons, length, replicate, zipWith)
import Data.Function (on)
import Data.Int (fromStringAs, binary, toNumber, floor)
import Data.Int.Bits ((.&.))
@winnab
winnab / gist:2c5608fe4034b2276f2a8664dbe9c9f0
Last active March 26, 2018 09:14
Gogland useful shortcuts

From another project

Navigation

  • Go to definition: cmd + B
  • Go to list of all method declarations: cmd + opt + B
  • Line up and down: cmd + shift + up or down arrow
  • Expansive text selection: option + up arrow (as many times as needed)
  • cmd+[: go back
  • cmd+]: go forward
  • alt+F7: find usages of the identifier under the cursor.

Aligning images

This is a guide for aligning images.

See the full Advanced Markdown doc for more tips and tricks

left alignment

@adham90
adham90 / spacemacs-keybindings
Last active April 5, 2024 14:24
spacemacs keybindings that i need to learn
SPC s c remove highlight
**** Files manipulations key bindings
Files manipulation commands (start with ~f~):
| Key Binding | Description |
|-------------+----------------------------------------------------------------|
| ~SPC f c~ | copy current file to a different location |
| ~SPC f C d~ | convert file from unix to dos encoding |
| ~SPC f C u~ | convert file from dos to unix encoding |
@JuanCaicedo
JuanCaicedo / spacemacs-learning.md
Last active June 18, 2018 19:02
Questions I've had while learning spacemacs

Questions

  • How do you navigate around directories?
    • Open tree view in files neotree
      • Shortcuts for neotree in evilmode in the docs
      • Using search (/) can be super useful to move around quickly
    • Use SPC p D to open the project root in Dired, and use SPC f j to jump to the Dired buffer corresponding to current buffer.
      • Dired shortcuts
        • copy C
        • rename R
  • delete D
@MichalZalecki
MichalZalecki / await-async.js
Created November 13, 2015 05:16
Run generators and and await/async
import axios from "axios";
export default async function () {
const { data: { id } } = await axios.get("//localhost:3000/id");
const { data: { group } } = await axios.get("//localhost:3000/group");
const { data: { name } } = await axios.get(`//localhost:3000/${group}/${id}`);
console.log(name); // Michał
}
@tim-br
tim-br / set_functions.hs
Created August 2, 2015 17:40
set functions from sicp for haskell
intersection_set _ [] = []
intersection_set [] _ = []
intersection_set (x:xs) ys
| element_of_set x ys = x : intersection_set xs ys
| otherwise = intersection_set xs ys
element_of_set _ [] = False
element_of_set x (y:ys)
| x == y = True
| otherwise = element_of_set x ys