Skip to content

Instantly share code, notes, and snippets.

# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
@jamtat
jamtat / appendToFile.py
Created October 18, 2013 13:50
A quick python script to append lines to the end of a file and create the file if it doesn't exist.
from os.path import abspath, exists
def appendToFile(filename, content):
f_path = abspath(filename)
mode = 'r+' if exists(f_path) else 'a+'
with open(f_path, mode) as f:
txt = f.read()
f.write(content+'\n')
# Example Usage
@jamtat
jamtat / pyramids.py
Last active December 24, 2015 21:29
Simple python script for drawing derpy pyramids
def makePyramid(height=50, char='.'):
#Takes a height and generates a pretty pyramid, can optionally supply a character from which to make pyramid
for i in range(0,height):
print( (height-1-i)*' '+char*(i*2+1))
def makeAwkwardPyramid(height=50, middle=' ', left='/', right='\\', bottom='-'):
#Like the other one but fancier.
for i in range(0,height):
print((height-1-i)*' '+left+middle*(i*2)+right)
@jamtat
jamtat / multipleOnChangeHandlers.js
Last active December 22, 2015 08:59
A js prototype with support for multiple onchange handlers
function Widget(el) {
}
Widget.prototype = {
_onchangehandlers: [],
_value: 0,
set onchange(handler) {