Skip to content

Instantly share code, notes, and snippets.

View calebegg's full-sized avatar

Caleb Eggensperger calebegg

View GitHub Profile
@calebegg
calebegg / gist:5409802
Created April 18, 2013 03:20
When offering an ordering of a list, there are two ways to interpret it: 1. This ordering supplies the location to which each item should be moved. 2. This ordering supplies the location from which each item should be pulled. So, for instance, if the original list is [a, b, c] and the ordering you wish to apply is [2, 3, 1], by method (1) you ge…
ln = 9
yesses = 0
nos = 0
for p in permutations(range(ln)):
ys = [0] * ln
for i in range(ln):
ys[p[i]] = i
if ys == p:
yesses += 1
@calebegg
calebegg / Main.java
Last active December 13, 2015 16:49
Code used to automatically generate some wallpapers I use. Here are four examples: http://imgur.com/a/7b7z2
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Random;