Skip to content

Instantly share code, notes, and snippets.

View boukeversteegh's full-sized avatar

Bouke Versteegh boukeversteegh

View GitHub Profile
<?php
abstract class DefaultController {
public function read($id) {
if( empty($id) ) {
throw Exception("No ID specified!");
}
$this->_read($id);
}
public abstract function _read($id);
/* TRIANGLE */
.triangle {
width: 0;
height: 0;
border-width: 10px;
border-style: solid;
border-color: transparent;
font-size: 0;
}
sites:
apidoc:
scheme: http
host: apidoctest.elephone.vb
api:
scheme: http
host: api.elephone.vb
nginx_sites:
<<<<<<< HEAD
@boukeversteegh
boukeversteegh / move_file_sessions_to_database.php
Created October 7, 2015 16:36
Migration to switch from file sessions to database sessions
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Session\FileSessionHandler;
use Illuminate\Session\DatabaseSessionHandler;
use Symfony\Component\Finder\Finder;
/**
* @author Bouke Versteegh
*/
@boukeversteegh
boukeversteegh / pipehttp.py
Created November 20, 2012 18:58
Pipe data to webserver
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")
@boukeversteegh
boukeversteegh / BADPS.md
Last active November 7, 2015 16:53
[DRAFT] Bitcoin Address Discovery Protocol over SMS

Bitcoin Address Discovery Protocol over SMS


Title:   Bitcoin Address Discovery Protocol over SMS
Author:  Bouke Versteegh <info@boukeversteegh.nl>
Status:  Draft
Created: 2014-03-14
require_once 'wopr.php';
$settings = array(
'host' => 'localhost',
'port' => 1981,
);
$wopr = new WOPR($settings['host'], $settings['port']);
$wopr->connect();
<style>
td {
padding: 4px;
}
input {
width: 100%;
display: block;
border: 1px inset #EEE;
margin: -1px;
}
# 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)
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