Title: Bitcoin Address Discovery Protocol over SMS
Author: Bouke Versteegh <[email protected]>
Status: Draft
Created: 2014-03-14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import BaseHTTPServer | |
import sys | |
server_host = 'localhost' | |
server_port = 8744 | |
class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler): | |
def do_HEAD(s): | |
s.send_response(200) | |
s.send_header("Content-type", "text/html") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_once 'wopr.php'; | |
$settings = array( | |
'host' => 'localhost', | |
'port' => 1981, | |
); | |
$wopr = new WOPR($settings['host'], $settings['port']); | |
$wopr->connect(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
td { | |
padding: 4px; | |
} | |
input { | |
width: 100%; | |
display: block; | |
border: 1px inset #EEE; | |
margin: -1px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Given a position (x,y), returns next position in a grid spiral. | |
def next(pos): | |
x, y = pos | |
top = False | |
right = False | |
bottom = False | |
left = False | |
horizontal = abs(x) <= abs(y) | |
vertical = abs(y) <= abs(x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import multiprocessing | |
# Define a function | |
square = lambda x: x**2 | |
if __name__ == "__main__": | |
mylist = [1, 2, 3, 4, 9, 2, 5, 2, 7, 0, 5, 4, 1, 3, 5, 7] | |
# Create a pool with 8 multicore threads | |
# Apply the function to all arguments in the list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Gate { | |
protected: | |
Out outputs[]; | |
public: | |
virtual void propagate(); | |
}; | |
void Gate::propagate() { | |
int noutputs = sizeof(this->outputs)/sizeof(*(this->outputs)); | |
cout << noutputs << " outputs."; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import inspect | |
# Callable class to wrap functions | |
class F: | |
def __init__(self, func, *args): | |
self.func = func | |
self.args = args | |
# Currying |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:document.location = $('[href^="//' + ['nl', 'en'][0+(document.location.host.substr(0,2)=="nl")] + '.wikipedia.org"]').attr('href'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
abstract class DefaultController { | |
public function read($id) { | |
if( empty($id) ) { | |
throw Exception("No ID specified!"); | |
} | |
$this->_read($id); | |
} | |
public abstract function _read($id); |
OlderNewer