Skip to content

Instantly share code, notes, and snippets.

View peanutbutterandcrackers's full-sized avatar

peanutbutterandcrackers

View GitHub Profile
@ajshort
ajshort / export-layers.py
Created November 26, 2010 03:51
GIMP Python script to export each layer as a separate image.
#!/usr/bin/env python
#
# A GIMP plugin to save each layer in an image as a separate file
from gimpfu import *
import os
def export_layers(img, drw, path, name):
img = img.duplicate()
@bobbyno
bobbyno / mit_scheme_bindings.txt
Created August 11, 2012 17:53
MIT Scheme bindings suitable for rlwrap completion
#
#!optional
#!rest
#(
#\
#\altmode
#\backnext
#\backspace
#\call
#\linefeed
@robmiller
robmiller / git-cleanup-repo
Last active February 27, 2024 10:09
A script for cleaning up Git repositories; it deletes branches that are fully merged into `origin/master`, prunes obsolete remote tracking branches, and as an added bonus will replicate these changes on the remote.
#!/bin/bash
# git-cleanup-repo
#
# Author: Rob Miller <rob@bigfish.co.uk>
# Adapted from the original by Yorick Sijsling
git checkout master &> /dev/null
# Make sure we're working with the most up-to-date version of master.
git fetch
@jwalanta
jwalanta / ne-trad.mim
Created October 11, 2013 15:14
Fixed ne-trad.mim (Nepali traditional input layout). Replace content of /usr/share/m17n/ne-trad.mim with this.
;; ne-trad.mim -- Nepali input method for traditional layout
;; This files implements the traditional keyboard layout published by MPP.
;; Copyright (c) 2005 Suyash Shrestha <suyash.shr@gmail.com>
;; This file is part of the m17n contrib; a sub-part of the m17n
;; library.
;; The m17n library is free software; you can redistribute it and/or
;; modify it under the terms of the GNU Lesser General Public License
;; as published by the Free Software Foundation; either version 2.1 of
@HansNewbie
HansNewbie / Python Turtle Fractal Plant.py
Last active July 18, 2021 20:09
Python Turtle Fractal Plant
# As described in http://en.wikipedia.org/wiki/L-system#Example_7:_Fractal_plant
import turtle
ruleInput = ['F', 'X']
ruleOutput = ["FF", "F-[[X]+X]+F[+FX]-X"]
start = "X"
front = 5
turn = 30
stack = []
@shockalotti
shockalotti / Go Golang - recursive function, fibonacci sequence
Created May 28, 2014 03:03
Go Golang - recursive function, fibonacci sequence
package main
import "fmt"
func fib(n uint) uint {
if n == 0 {
return 0
} else if n == 1 {
return 1
} else {
@john-science
john-science / build_your_own_lisp.md
Last active December 9, 2021 05:27
Build Your Own LISP

Build Your Own LISP

I had fun building my own LISP (Slow Loris). The project was extremely easy to get off the ground, because there a ton of resources to do just this. I thought it might be handy to have a little links round-up, based on my research.

In Python

There are already several good projects out there on writing your own LISP in Python.

Peter Norvig's LisPy

Screencapture and animated gifs

I say "animated gif" but in reality I think it's irresponsible to be serving "real" GIF files to people now. You should be serving gfy's, gifv's, webm, mp4s, whatever. They're a fraction of the filesize making it easier for you to deliver high fidelity, full color animation very quickly, especially on bad mobile connections. (But I suppose if you're just doing this for small audiences (like bug reporting), then LICEcap is a good solution).

Capturing (Easy)

  1. Launch quicktime player
  2. do Screen recording

screen shot 2014-10-22 at 11 16 23 am

@glombard
glombard / combine.py
Created November 24, 2014 00:22
Merging 4 images into one with Python and PIL/Pillow
# Combine multiple images into one.
#
# To install the Pillow module on Mac OS X:
#
# $ xcode-select --install
# $ brew install libtiff libjpeg webp little-cms2
# $ pip install Pillow
#
from __future__ import print_function
#!/usr/bin/env python
# Tutorial available at: https://www.youtube.com/watch?v=nmb-0KcgXzI
# Feedback welcome: jacksonbates@hotmail.com
from gimpfu import *
def NAME_OF_MAIN_FUNCTION(image, drawable):
# function code goes here...