Skip to content

Instantly share code, notes, and snippets.

Avatar

cyberbikepunk cyberbikepunk

View GitHub Profile
@cyberbikepunk
cyberbikepunk / image_linker.py
Last active Aug 29, 2015
Recursively look for images inside a source folder and create flat symlinks inside a destination folder.
View image_linker.py
#! /usr/bin/python3
"""
Recursively look for images inside a source folder
and create flat symlinks inside a destination folder.
"""
from argparse import ArgumentParser
from os import walk
from pathlib import Path
View sshd_config
# Package generated configuration file
# See the sshd_config(5) manpage for details
# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
@cyberbikepunk
cyberbikepunk / repo.sh
Last active Sep 12, 2015 — forked from james2doyle/create-repo.sh
Create a repo on Github from the command line
View repo.sh
function repo() {
if [ $# -eq 2 ]; then
# name of repo to be created
PROJECTNAME="$1"
DESCRIPTION="$2"
POST="{\"name\":\"$PROJECTNAME\",\"description\":\"$DESCRIPTION\"}"
curl –sS -u 'cyberbikepunk' https://api.github.com/user/repos -d "$POST"
git remote add origin git@github.com:cyberbikepunk/$PROJECTNAME.git
echo "remote origin added"
else
@cyberbikepunk
cyberbikepunk / bokeh_send_plot_to_the_server.ipynb
Created Sep 12, 2015
Render a Bokeh plot with the server
View bokeh_send_plot_to_the_server.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cyberbikepunk
cyberbikepunk / create_pandas_dataframe_without_column_or_row_names.ipynb
Created Sep 12, 2015
It's possible to create a panda dataframe without defining columns or row names
View create_pandas_dataframe_without_column_or_row_names.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cyberbikepunk
cyberbikepunk / using_a_class_instance_as_a_decorator.py
Created Sep 13, 2015
use a class instance to make a decorator
View using_a_class_instance_as_a_decorator.py
# Write a tracer decorator
class Tracer():
def __init__(self):
pass
def __call__(self, f):
def wrapper(*args, **kwargs):
print('Called function %s' % f.__name__)
return f(*args, **kwargs)
return wrapper
@cyberbikepunk
cyberbikepunk / simple_threaded_counter.py
Last active Sep 13, 2015
a simple threaded counter implemented in pythobn
View simple_threaded_counter.py
from logging import basicConfig, DEBUG, debug
from threading import Lock, Thread, current_thread, enumerate
from time import sleep
from random import random
basicConfig(level=DEBUG, format='[%(thread)d: %(message)s]')
class Counter(object):
def __init__(self, start=0):
@cyberbikepunk
cyberbikepunk / decorator_experiments.ipynb
Created Sep 13, 2015
Monkey-patching with decorators: a tutorial for beginners
View decorator_experiments.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cyberbikepunk
cyberbikepunk / decorator_experiments.ipynb
Created Sep 13, 2015
Monkey-patching with decorators: a tutorial for beginners
View decorator_experiments.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cyberbikepunk
cyberbikepunk / ipython_to_jekyll.py
Created Sep 13, 2015
convert ipthon notebook files to jekyll
View ipython_to_jekyll.py
#!/usr/bin/env python
# coding=utf-8
from __future__ import print_function
import functools
import json
import os
import re
import sys