Skip to content

Instantly share code, notes, and snippets.

Avatar

cyberbikepunk cyberbikepunk

View GitHub Profile
@cyberbikepunk
cyberbikepunk / ElasticSearch.sh
Created Jun 18, 2016 — forked from ricardo-rossi/ElasticSearch.sh
Installing ElasticSearch on Ubuntu 14.04
View ElasticSearch.sh
#!/bin/bash
### USAGE
###
### ./ElasticSearch.sh 1.7 will install Elasticsearch 1.7
### ./ElasticSearch.sh will fail because no version was specified (exit code 1)
###
### CLI options Contributed by @janpieper
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch
@cyberbikepunk
cyberbikepunk / print_all_settings.py
Created May 16, 2016
Print all CAPITALIZED settings in a settings file.
View print_all_settings.py
def show_settings():
""" Echo all settings. """
print('Current m5 settings:', end='\n\n')
objects = dir(modules[__name__])
parameters = [x for x in objects if x.isupper() and x is not 'PASSWORD']
for p in parameters:
value = getattr(modules[__name__], p)
print('{item} = {value!r}'.format(item=p.rjust(20, ' '), value=value))
@cyberbikepunk
cyberbikepunk / parametrized_pytest.py
Last active May 10, 2016
StackOverflow Question 37124766
View parametrized_pytest.py
from pytest import mark
items = [
{
'text': 'bla bla',
'fields': [('bla', 0), ('foo', -1)]
},
{
'text': 'foo bar',
@cyberbikepunk
cyberbikepunk / postal_codes.py
Last active Oct 22, 2015
Regex patterns for postal codes of ~150 countries
View postal_codes.py
# Source: http://download.geonames.org/export/dump/countryInfo.txt
POSTAL_CODES = {
'AD': '(?:AD)*(\d{3})',
'AM': '(\d{6})',
'AR': '[A-Z]\d{4}[A-Z]{3})',
'AT': '(\d{4})',
'AU': '(\d{4})',
'AX': '(?:FI)*(\d{5})',
'AZ': '(?:AZ)*(\d{4})',
'BA': '(\d{5})',
View defender.js
/*
This AI simply saves the planet.
*/
function find_closest_rock(rocks){
var closest = 0
for (var i = 1; i < rocks.length; i++){
if (rocks[i].distance < rocks[closest].distance){
closest = i
@cyberbikepunk
cyberbikepunk / dpaste.de_snippet.py
Last active Oct 5, 2015 — forked from anonymous/dpaste.de_snippet.py
Quick Unittest Mock tutorial
View dpaste.de_snippet.py
my_singleton = None
class Foo(object):
def __init__(self):
pass
def do(arg):
View micro_cv.md

Micro CV

Personal info

  • Born in 1975 in Paris, currently in Berlin
  • English (native), French (native), German (pretty good)

Education

  • MSci. in physics, Imperial College London
  • Ph.D in experimental atmospheric physics, University of Toronto
@cyberbikepunk
cyberbikepunk / aggregator.py
Last active Sep 19, 2015
Download all files from a GitHub repo
View aggregator.py
""" This module interfaces with GitHub. """
from os.path import splitext
from json import loads
from base64 import b64decode
from requests import get
from .murls import https
@cyberbikepunk
cyberbikepunk / string_processors.py
Last active Sep 19, 2015
Random string processors
View string_processors.py
from string import ascii_letters, digits
from re import match, sub
from time import strptime
from unicodedata import normalize
from datetime import datetime
SLUG_SEPERATOR = '-'
_multiple_seperators_regex = '%s{2,}' % SLUG_SEPERATOR # eg. bla-bla--bla
@cyberbikepunk
cyberbikepunk / generic.ipynb
Last active Sep 19, 2015
The generic ipython notebook format
View generic.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.