Skip to content

Instantly share code, notes, and snippets.

View azeroz's full-sized avatar

azeroz azeroz

View GitHub Profile
@azeroz
azeroz / gist:9fe252c66573a31348d7e49e6385fb79
Created December 10, 2017 00:13
Excerpt_Mastering_Blockchain.md
Non-outsourceable puzzles
The key motivation behind this puzzle is to develop resistance again the development of mining pools. Mining pools as previously discussed offer rewards to all participants in proportion to the computing power they consume. However, in this model the mining pool operator is a central authority to whom all the rewards go and who can enforce certain rules. Also, in this model all miners only trust each other because they are working towards a common goal together in the hope of the pool manager getting the reward. Non-outsourceable puzzles are a scheme that allows miners to claim rewards for themselves; consequently pool formation becomes unlikely due to inherent mistrust between anonymous miners.
The idea behind difficulty regulation in bitcoin is that a generation of 2016 blocks should take roughly around 2 weeks (inter-block time should be around 10 minutes). If it takes longer than 2 weeks to mine 2016 blocks then the difficulty is decreased and if it takes less than two weeks to
#!/bin/bash
# This hook is run after a new virtualenv is activated.
# ~/.virtualenvs/postmkvirtualenv
libs=( PyQt4 sip.so )
python_version=python$(python -c "import sys; print (str(sys.version_info[0])+'.'+str(sys.version_info[1]))")
var=( $(which -a $python_version) )
get_python_lib_cmd="from distutils.sysconfig import get_python_lib; print (get_python_lib())"
#!/usr/bin/env Rscript
args <- commandArgs(TRUE)
## cores should not be greater than the number of gigs of available memory.
cores <- if(length(args) > 0L) { as.numeric(args[1]) } else 4L
# Download Bid/Ask tick data for 15 FX pairs since May 2009 from TrueFX.com
#
# Garrett See
#
# You probably _should_ sign up for a FREE account with TrueFX before
@azeroz
azeroz / latency.txt
Created December 28, 2012 17:34 — forked from jboner/latency.txt
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 4K randomly from SSD* 150,000 ns 0.15 ms
@azeroz
azeroz / foxyproxy.xml
Created October 7, 2012 03:45
Tor and i2p foxyproxy config. Change manualconf tor port fields (38817) to your own SocksPort from torrc.
<?xml version="1.0" encoding="UTF-8"?>
<foxyproxy mode="patterns" selectedTabIndex="0" toolbaricon="true" toolsMenu="true" contextMenu="true" advancedMenus="false" previousMode="disabled" resetIconColors="true" useStatusBarPrefix="true" excludePatternsFromCycling="false" excludeDisabledFromCycling="false" ignoreProxyScheme="false" apiDisabled="false">
<random includeDirect="false" includeDisabled="false"/>
<statusbar icon="true" text="false" left="options" middle="cycle" right="contextmenu" width="0"/>
<toolbar left="options" middle="cycle" right="contextmenu"/>
<logg enabled="false" maxSize="500" noURLs="false" header="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;&lt;head&gt;&lt;title&gt;&lt;/title&gt;&lt;link rel=&quot;icon&quot; href=&quot;http://getfoxyproxy.org/favicon.ico&quot;/&gt;&lt;link r
@azeroz
azeroz / socks24.py
Created September 5, 2012 02:07
Scrape socks24
#!/usr/bin/env python
import sys, re
import argparse
from datetime import datetime
from urllib import urlopen
from BeautifulSoup import BeautifulSoup
def main(url):
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Library General Public License for more details.
#
open System
open System.IO
open System.Xml
open System.Text
open System.Net
open System.Globalization
let makeUrl symbol (dfrom:DateTime) (dto:DateTime) =
//Uses the not-so-known chart-data:
new Uri("http://ichart.finance.yahoo.com/table.csv?s=" + symbol +