Skip to content

Instantly share code, notes, and snippets.

View thinkallabout's full-sized avatar

Cameron Brown thinkallabout

  • United Kingdom
  • 09:24 (UTC +01:00)
View GitHub Profile
#Quick cp from http://sekati.com/etc/install-nodejs-on-debian-squeeze
#
#Needed to install TileMill from MapBox
#
#Installs node.js which has npm bundled
#
#Build Dependencies
sudo apt-get update && apt-get install git-core curl build-essential openssl libssl-dev
import re
from hashlib import md5
def gfm(text):
# Extract pre blocks.
extractions = {}
def pre_extraction_callback(matchobj):
digest = md5(matchobj.group(0)).hexdigest()
extractions[digest] = matchobj.group(0)
return "{gfm-extraction-%s}" % digest
@thinkallabout
thinkallabout / 0_reuse_code.js
Created May 22, 2014 14:11
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@thinkallabout
thinkallabout / gist:76952b3d2f812710887f
Created May 22, 2014 19:53
Markdown Kitchen Sink from /adamschwartz/github-markdown-kitchen-sink
[View raw (TEST.md)](https://raw.github.com/adamschwartz/github-markdown-kitchen-sink/master/README.md)
This is a paragraph.
This is a paragraph.
Header 1
========
#!/usr/bin/env python
# encoding: utf-8
import os
import tkinter
from tkinter.filedialog import *
from tkinter.messagebox import *
from tkinter.ttk import *
def donothing():
@thinkallabout
thinkallabout / tutorial.py
Created November 4, 2016 01:03
Quick and easy Python tutorial
### 1. BASIC STATEMENTS ###
# These are examples of basic data types in Python. They're basically the same
# in all programming languages but are all presented slightly differently.
# String: "Hello"
# Number: 5
# Boolean: False
# List: []
# Tuple: []
set nocompatible
filetype plugin on
syntax on
set tabstop=4
set shiftwidth=4
set expandtab
call pathogen#infect()
PS1="\\W \[\033[38;5;220m\]\\$\[$(tput sgr0)\] "
@thinkallabout
thinkallabout / demo.py
Last active November 3, 2024 14:59
Source Engine .dem parser (header)
# Copyright 2019 Cameron Brown
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an 'AS IS' BASIS,
@thinkallabout
thinkallabout / ga.py
Created May 8, 2019 13:28
Post to Google Analytics Measurement Protocol with this Python function
def track_event(category, action, label=None, value=0):
data = {
'v': '1', # API Version.
'tid': GA_TRACKING_ID, # Tracking ID / Property ID.
# Anonymous Client Identifier. Ideally, this should be a UUID that
# is associated with particular user, device, or browser instance.
'cid': '555',
't': 'event', # Event hit type.
'ec': category, # Event category.
'ea': action, # Event action.