Skip to content

Instantly share code, notes, and snippets.

@diopib
diopib / tinyblock.py
Created August 23, 2017 19:57
Very tiny BlockChain implementation for learning purpose
"""
Very tiny blockchain implementation -- for learning purpose
"""
import hashlib
import datetime
__author__ = "ibrahim@sikilabs.com"
__reference__ = "https://medium.com/crypto-currently/lets-build-the-tiniest-blockchain-e70965a248b"
@diopib
diopib / remote_copy.py
Created July 25, 2017 13:33
Securely copy a file from A to B using SSH
import paramiko
from scp import SCPClient
__author__ = "ibrahim@sikilabs.com"
"""
Example script: file scp
requirements:
- paramiko==2.2.1
- scp==0.10.2
@diopib
diopib / Contract Killer 3.md
Created August 19, 2016 20:33 — forked from malarkey/Contract Killer 3.md
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

@diopib
diopib / Three Wise Monkeys.md
Created August 19, 2016 20:33 — forked from malarkey/Three Wise Monkeys.md
Three Wise Monkeys (NDA)

Date: [date]

Between us [company name] and you [customer name].

Summary:

In short; neither of us will share any confidential information about each-other, by any means, with anyone else.

What’s confidential information?

@diopib
diopib / ddns.py
Created March 11, 2014 21:08 — forked from JonJanzen/ddns.py
#!/usr/bin/python
# Use this script to update a DNS override using the webfaction API
# be sure to set your username, password, dns override, and ethenet interface.
# Then add a crontab entry for the script, I use every 5 minutes
# */5 * * * * /path/to/ddns.py
# This is safe as the script exit(0)'s if the ip is the same as wehat is recorded in the file.
# Webfaction documentation on DNS overrides
# http://docs.webfaction.com/user-guide/domains.html#overriding-dns-records-with-the-control-panel
@diopib
diopib / smart_extract.py
Created February 25, 2014 21:59
archive smart extractor
__author__ = "Ibrahim Diop <http://ibrahim.zinaria.com>"
import sh # http://amoffat.github.io/sh/
import os
import ntpath
def smart_extract(dirname):
"""
extract all zip file contained in specified directory
@diopib
diopib / utils.py
Created January 28, 2014 20:02
Python Little Utilities
"""
python useful stuff
"""
def mutual_ex(a, b):
"""
return a list of element only in a or b
"""
return [i for i in a if i not in b] + [j for j in b if j not in a]
@diopib
diopib / catalog.py
Last active December 29, 2015 13:49
A class that uses different static function depending of a parameter passed in init
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
A class that uses different static function depending of a parameter passed in
init. Note the use of a single dictionnary instead of multiple conditions
"""
__author__ = "Ibrahim Diop <http://ibrahim.zinaria.com>"
__gist__ = "<https://gist.github.com/diopib/7679559>"
@diopib
diopib / ideagen.py
Created February 11, 2013 16:56 — forked from jorendorff/ideagen.py
""" Generate lovely ideas for hack day talks """
import random
import re
productions = {
'tech': [
'HTML5',
'Audio',
'CoffeeScript',
@diopib
diopib / traversal.py
Last active December 12, 2015 08:08
Python Nested Dictionaries Traversal Search
def df_traversal(d):
"""
depth-first traversal for dict d
pre-order method
ref: http://en.wikipedia.org/wiki/Tree_traversal
ref: http://en.wikipedia.org/wiki/Depth-first_search
"""
for key in d:
print key