Skip to content

Instantly share code, notes, and snippets.

@hawkz
hawkz / python33.txt
Created July 15, 2012 22:34
Python in 33 sentences
print - lets you output numbers and characters to the console.
if - let's you choose which statements are executed if an expression is true
else - denotes the statements that execute if the expression isn't true
elif - let's you combine if statements
while - is a way of repeating statements in a loop until an expression is false.
break - is a way to jump out of the statement flow of a loop.
continue - let's you skip a cycle of the flow without ending it.
for - is used to iterate over items of a collection in the order they appear in a container
@hawkz
hawkz / rem-fallback.less
Last active December 14, 2015 08:08 — forked from drublic/rem-fallback.less
Quick modification for multiple values - not the most concise, but this is being compiled pre-upload...
@main-font-size: 16px;
.x-rem (@property, @value) {
// This is a workaround, inspired by https://github.com/borodean/less-properties
@px-fallback: @value * @main-font-size;
-: ~`(function () { return ';@{property}: @{px-fallback}'; }())`;
-: ~`(function () { return ';@{property}: @{value}rem'; }())`;
}
.x-rem (@property, @v1, @v2) {
@px-v1: @v1 * @main-font-size;
@hawkz
hawkz / gist:6350440
Created August 27, 2013 06:59
PyCon UK 2013 Song
We code in Python when we're able.
use 'geek' as a proud label.
We script routines its in our genes:
white space is so read-able.
Learn PEP8 here as you'll be taught,
in sprints and jams and talks the lot.
We code in Python when we're able
version 3. is fast. and stable
@hawkz
hawkz / SVG Stroke Text Effect.markdown
Created September 5, 2015 17:30
SVG Stroke Text Effect
@hawkz
hawkz / html5video.sh
Created January 6, 2016 13:53 — forked from liamcurry/html5video.sh
automated conversion of a file to all three html5 compatible video formats - h.264, ogg, and webm
#!/bin/sh
# Output file for HTML5 video
# requirements: ffmpeg .6+
# usage: ./html5video.sh infile.mp4 640x360
target_directory='converted'
file=`basename $1`
filename=${file%.*}
filepath=`dirname $1`
import pyb
switch = pyb.Switch()
leds = [pyb.LED(i+1) for i in range(4)]
accel = pyb.Accel()
i = 0
while not switch():
y = accel.y()
i = (i + (1 if y > 0 else -1)) % len(leds)
# Django & Intercom.io
Create a template tag:
```python
import hashlib as h
import hmac as h2
@register.filter(name='hmac')
def hmac(userid, key):
"""Return the encrypted key"""
@hawkz
hawkz / rock-paper-lasers.py
Created February 27, 2017 12:54
Quick Python game
#!/usr/bin/python3
"""An LED wizard battle."""
import random
def reset(beam=[0] * 30):
"""Start the battle."""
beam = ['-'] * int(len(beam) / 2) + ['-'] * int(len(beam) / 2)
beam[int(len(beam) / 2)] = '*'
return beam
@font-face {
font-family: 'icons';
src: url(../fonts/icons.eot?social);
src: url(../fonts/icons.eot?#iefixsocial) format("embedded-opentype"),
url(../fonts/icons.woff?social) format("woff"),
url(../fonts/icons.ttf?social) format("truetype"),
url(../fonts/icons.svg?social#icons) format("svg");
font-weight: normal;
font-style: normal;
}

Keybase proof

I hereby claim:

  • I am hawkz on github.
  • I am hawkz (https://keybase.io/hawkz) on keybase.
  • I have a public key ASDRT-L_53MaZSGJ-bVqYrGtB23qjlBerMmbn6pkzd9shAo

To claim this, I am signing this object: