Skip to content

Instantly share code, notes, and snippets.


Ken Bolton kenbolton

  • BScientific
  • Beacon, NY
View GitHub Profile
kenbolton /
Created Jun 11, 2019 — forked from heptal/
Hammerspoon replacement for Caffeine


Simple toggleable menubar replacement for Caffeine in Hammerspoon, utilizing ASCIImage (for vector) to create the amphetamine icons. Motivated by the official Caffeine app's icon looking bad on Retina

Get latest version here: amphetamine.lua

Save as amphetamine.lua in ~/.hammerspoon/ and put amphetamine = require "amphetamine" in your init.lua


Useful Spacemacs commands

  • `SPC q q` - quit
  • `SPC w /` - split window vertically
  • `SPC w` - - split window horizontally
  • `SPC 1` - switch to window 1
  • `SPC 2` - switch to window 2
  • `SPC w c` - delete current window
  • `SPC TAB` - switch to previous buffer
  • `SPC b b` - switch buffers

Keybase proof

I hereby claim:

  • I am kenbolton on github.
  • I am kenbolton ( on keybase.
  • I have a public key whose fingerprint is F43F 3EA4 4440 2A44 8E43 E7C9 AD7E 8178 CD53 B45A

To claim this, I am signing this object:

kenbolton /
Last active Dec 19, 2015
Remove 'in_menus' from Mezzanine's `Page` instance admin. Insert '_order' at the beginning of the list of fields.
from copy import deepcopy
from django.contrib import admin
from mezzanine.pages.admin import PageAdmin
from mezzanine.pages.models import Page
fieldsets = deepcopy(PageAdmin.fieldsets)
fieldsets[0][1]["fields"].insert(0, '_order')
View gist:5710648
def main():
list_of_primes = [2]
while len(list_of_primes) < 1000:
if list_of_primes[-1] % 2 == 0:
value = list_of_primes[-1] + 1
value += 2
is_prime = True
for i in list_of_primes:
if i > value * 0.5:
kenbolton /
Last active Dec 14, 2015 — forked from mikeyk/gist:1329319
Python script to test Redis set/get, hashed sets, memcached, and PostgreSQL hstore for memory consumption.
#! /usr/bin/env python
import redis
import random
import pylibmc
import psycopg2
import sys
from time import clock
r = redis.Redis(host='localhost', port=6379)
kenbolton /
Created Feb 13, 2013
Django-Social-Auth and Mezzanine/Cartridge integration from spring 2012. It looks like `mezzanine.accounts`, but the integration with that app is likely incomplete.
from django.contrib.auth.models import User
from django.db import models
from django.db.models.signals import post_save
from mezzanine.core.fields import RichTextField
from import Product
from social_auth.signals import pre_update
from import GoogleOAuth2Backend
kenbolton /
Last active Dec 12, 2015
Some tentative Mezzanine additions.
def download_media():
media = 'media.tar.gz'
run("tar -czvf %s/%s -C %s/static/media/" % (env.proj_path, media,
get('%s/%s' % (env.proj_path, media), media)
kenbolton / Vagrantfile
Created Jan 14, 2013
This is the base Vagrantfile for my Django work. I don't know how I came to this, but it works. I first run `vagrant box add precise64` and `vagrant init precise64`, drop in this Vagrantfile, then `vagrant up`. Read the current Vagrant documentation, as the values in this gist may no longer be valid!
View Vagrantfile do |config| = "precise64" :hostonly, ""
View gist:4226648
$(function() {
// Create filter actions.
var checkbox = $('input[name=joins-leaves]')
$('label[for=joins-leaves]').toggle( function () {
$('.joins, .leaves').css({'display': 'none'});
checkbox.prop('checked', true);
}, function () {
$(".joins, .leaves").css({'display': 'table-row'});
checkbox.prop('checked', false);