Skip to content

Instantly share code, notes, and snippets.

View feulf's full-sized avatar
🐢
slow and steady wins the race

Federico feulf

🐢
slow and steady wins the race
View GitHub Profile
@feulf
feulf / gist:6229858
Created August 14, 2013 10:33
tmux fede
# Enable mouse support in ~/.tmux.conf
setw -g mode-mouse on
set-option -g mouse-select-pane on
set-option -g mouse-select-window on
set -g mouse-resize-pane on
set -g mouse-select-window on
# enable pbcopy pbpaste
set-option -g default-command "reattach-to-user-namespace -l bash"
@feulf
feulf / gist:8408501
Created January 13, 2014 21:27
tmux configuration
# Mouse support
setw -g mode-mouse on
set-option -g mouse-select-pane on
set-option -g mouse-select-window on
set -g mouse-resize-pane on
set -g mouse-select-window on
# tmux vi mode
setw -g mode-keys vi
const OpenTimestamps = require('javascript-opentimestamps');
var fs = require('fs');
fs.readFile('bitcoin.pdf.ots', 'utf8', (err, contents) => {
const fileOts = Buffer.from(contents.toString('utf8'));
const detached = OpenTimestamps.DetachedTimestampFile.deserialize(fileOts);
const infoResult = OpenTimestamps.info(detached);
console.log(infoResult)
});
@feulf
feulf / lightning_network_workshop_1_commands.md
Last active April 10, 2018 05:10
Workshop Series 1: Lightning Network

Lightning Network Workshop Series 1

  1. Run btcd
./btcd --simnet --rpcuser=kek --rpcpass=kek --txindex --connect=YOUR_IP
  1. Run lnd
./lnd --bitcoin.active --bitcoin.simnet --bitcoin.node=btcd --btcd.rpcuser=kek --btcd.rpcpass=kek --debuglevel=trace --noencryptwallet
@feulf
feulf / gist:4437179
Created January 2, 2013 19:30
This snippet is an HTML page with a Javascript that "emulate" Varnish loading the <esi:include> blocks client side. The idea is to create a dynamic website in HTML loaded in S3, with groundbreaking performances. Hope this experiment will inspire better solutions.
<!DOCTYPE html>
<html>
<head></head>
<body>
<esi:include src="head.html" alt="not-found.html" onerror="continue"></esi:include>
<esi:include src="body.php" alt="not-found.html" onerror="continue"/>
<h2>HTML</h2>
</esi:include>
<esi:include src="footer.html" alt="not-found.html" onerror="continue"/></esi:include>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
const functions = require('firebase-functions')
const admin = require('firebase-admin')
admin.initializeApp()
const db = admin.firestore()
const settings = {timestampsInSnapshots: true};
db.settings(settings);
@feulf
feulf / bitcoin_attacker_success_probability.c
Created October 3, 2019 19:46
C code that shows the Poisson distribution of the probability to attack Bitcoin.
#include <math.h>
#include <stdio.h>
double AttackerSuccessProbability(double q, int z) {
double p = 1.0 - q;
double lambda = z * (q / p);
double sum = 1.0;
int i, k;
for (k = 0; k <= z; k++)
{
@feulf
feulf / data-types.py
Created October 29, 2019 20:42
Data Types in Python
# Boolean
# ------------------
print(True)
print(False)
print(type(True))
# Integers
# ------------------
# Python 3 has no limit for the data size. Aside the memory of course.
num = 0b000000001
#print(bin(num))
num = 0b000000001 << 1 # 0b10
#print(bin(num))
num = 0b000000001 << 2 # 0b100
#print(bin(num))
num = 0b000000001 >> 1 # 0b0