Skip to content

Instantly share code, notes, and snippets.

View gregorynicholas's full-sized avatar
💀
alter.

gregory nicholas gregorynicholas

💀
alter.
View GitHub Profile
#!/bin/bash
# Favicon and Apple Touch Icon Generator
#
# This bash script takes an image as a parameter, and uses ImageMagick to convert it to several
# other formats used on modern websites. The following copies are generated:
#
# * apple-touch-icon-114x114-precomposed.png
# * apple-touch-icon-57x57-precomposed.png
# * apple-touch-icon-72x72-precomposed.png
#disable dashboard
defaults write com.apple.dashboard mcx-disabled -boolean YES
# must restart dock before it takes effect
killall dock
import Image
import math
def hsv_to_rgb(h, s, v):
if s * v == 0:
r, g, b = v, v, v
else:
hi = int(math.floor(3 * h / math.pi)) % 6
f = 3 * h / math.pi - hi;
p = v * (1.0 - s)
from werkzeug.debug.tbtools import Traceback
from phomp.api.errors import PhompException
def wrap_exceptional(f):
config = 'default_settings'
def wrap(f):
def wrapper(*args, **kwargs):
try:
return f(*args, **kwargs)
except Exception:
# Copyright 2008 Google Inc.
#
# 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,
@gregorynicholas
gregorynicholas / delete_tests.py
Created March 15, 2013 21:15 — forked from someone1/delete_tests.py
appengine NDB delete tests
from google.appengine.ext.ndb import model, context, tasklets
from random import choice
import string
from werkzeug import Response
class Items(model.Model):
user = model.StringProperty()
@classmethod
@tasklets.tasklet
import webapp2
import decimal
import logging
import random
import string
from google.appengine.api import datastore_errors
from google.appengine.datastore import entity_pb
from google.appengine.ext import db
// {{compare unicorns ponies operator="<"}}
// I knew it, unicorns are just low-quality ponies!
// {{/compare}}
//
// (defaults to == if operator omitted)
//
// {{equal unicorns ponies }}
// That's amazing, unicorns are actually undercover ponies
// {{/equal}}
// (from http://doginthehat.com.au/2012/02/comparison-block-helper-for-handlebars-templates/)
from __future__ import with_statement
from fabric.api import env
from fabric.api import *
from fabric.contrib.console import confirm
from fabric.contrib.project import upload_project
import ubuntu
import protobuf
#on branch with your commit that you need to split up
git checkout -b new_branch_name
git log -n1
#now record the sha hash of the last commit, lets call it SHA
#make sure you're on a new branch and you have no working directory changes
#this next command will wipe out everything and reset you to the previous commit
git reset --hard HEAD^
git cherry-pick SHA --no-commit
git add /filename/you/_want_/to/pull/request
git commit