Skip to content

Instantly share code, notes, and snippets.

@SteveClement
SteveClement / get_dir_size.py
Created September 20, 2012 12:18
Get Directory size in python
import os
def get_size(start_path = '.'):
total_size = 0
for dirpath, dirnames, filenames in os.walk(start_path):
for f in filenames:
fp = os.path.join(dirpath, f)
total_size += os.path.getsize(fp)
return total_size
print get_size()
#!/usr/bin/env python
#
# Initially based on sudoku-password card
#
# This software is in the public domain
#
# python password-card.py -c 100 -p 13 -n 10
#
# Alexandre Dulaunoy (a<AT>foo.be)
@SteveClement
SteveClement / bullshit_generator.py
Created February 18, 2014 12:28
Found (https://mail.python.org/pipermail/python-list/2009-March/530858.html) this nice Bullshit Generator by Pierre Denis. Adapted it to Python3
'''
======================================================================
Bullshit Generator
by Pierre Denis, March 2009
======================================================================
'''
# --------------------------------------------------
# grammar engine
# --------------------------------------------------
@SteveClement
SteveClement / emoji.py
Last active August 29, 2015 14:01 — forked from lepture/emoji.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012, lepture.com
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
@SteveClement
SteveClement / update_Arduino_libraries_git.sh
Created August 11, 2014 14:02
OSX Only, goes into your Arduino libraries folder, enumerates git repos and updates them
#!/usr/bin/env bash
cd ~/Documents/Arduino/libraries/
for pkg in `find . -name .git | cut -f2 -d. |tr -d \/ |grep -v Adafruit_LED_Backpack_LibraryAdafruit-LED-Backpack-Library`; do
cd ${pkg}
git pull
cd ..
done

Keybase proof

I hereby claim:

  • I am SteveClement on github.
  • I am steveclement (https://keybase.io/steveclement) on keybase.
  • I have a public key whose fingerprint is 3F4D 8CF6 08F9 4F88 2815 2CB1 69A2 0F50 9BE4 AEE9

To claim this, I am signing this object:

@SteveClement
SteveClement / font-example.py
Created February 19, 2015 18:31
Simple font example
#!/usr/bin/env python3
import pygame, time
from pygame.locals import *
done = False
pygame.init()
pygame.font.init()
screen = pygame.display.set_mode((320,240))
@SteveClement
SteveClement / kepler.py
Created February 26, 2015 17:28
Keplers law with vpython
#Kepler's Laws.py
# plots the orbit of a planet in an eccentric orbit to illustrate
# the sweeping out of equal areas in equal times, with sun at focus
# The eccentricity of the orbit is random and determined by the initial velocity
# program uses normalised units (G =1)
# program by Peter Borcherds, University of Birmingham, England
from visual import *
@SteveClement
SteveClement / gist:c3c7f01f6bcf2b2f674f
Created March 5, 2015 17:15
Rudimentary keyboard input in pygame
events = pygame.event.get()
for event in events:
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_LEFT:
location -= 1
if event.key == pygame.K_RIGHT:
location += 1
@SteveClement
SteveClement / map.data-gares.js
Last active August 29, 2015 14:18
GPS co-ordinates of CFL Train Stations
/* map.data-gares.js - copyright 2013, C-Services Contains the station DATA for the CFL !!!!!!!! DO NOT ALTER THIS FILE !!!!!!!!*/
var gaStationInfo = {
gare8200002: {
Position: [6.086145, 49.492568],
StaticName: "Dudelange-Burange",
Name: "Dudelange-Burange",
Body: "<p>CFL - Gare de Dudelange-Burange<br>Route de Burange<br>L-3481 Dudelange</p><div>Information&#58;<br>Tel. (352) 2489 2489&#160;(6.00&#160;- 22.00)</div><div>Lost &amp; found&#58;<br>Tel. (352) 4990 5574&#160;(6.00&#160;- 21.30)</div><p>​</p>",
Url: "/espaces/voyageurs/en/gares-et-services/nos-gares/dudelange-burange",
ImageUrl: "{imageurl}"
},