Skip to content

Instantly share code, notes, and snippets.

Avatar

William Entriken fulldecent

View GitHub Profile
@fulldecent
fulldecent / sudoku.pl
Last active Oct 8, 2015
Perl Sudoku solver
View sudoku.pl
#!/usr/bin/perl
# usage: $0 00030050204050205040520370782340520508485019857294857049587
use integer;
@A = split //, <>;
sub R {
return if grep { # if this solution is invalid, bail
($_ / 9 == $i / 9 # find pairs of boxes to compare
View gist:3909763
echo "FD & mnh
FD & minamhere
fd & MNH
Fd & MNH
fulld & mnh
fulld & minamhere
fulldecent & mnh
fulldecent & minamhere
fd MNH
fulld MNH
@fulldecent
fulldecent / reminders.scpt
Created Oct 20, 2012 — forked from statonjr/reminders.scpt
Write out Reminders to file on desktop
View reminders.scpt
tell application "Reminders"
set todo_accounts to every account
-- accounts have lists. loop thru accounts to get their lists.
repeat with i from 1 to length of todo_accounts
tell account i
set todo_lists to get every list
-- lists have reminders. loop thru lists to get their reminders
repeat with j from 1 to length of todo_lists
tell list j
set todos to (get reminders)
View unroll-recursion.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct node {
int value;
struct node *left;
struct node *right;
} node;
View How many ways to pick XX balls
// See https://math.stackexchange.com/questions/835031/how-many-ways-to-pick-x-balls
double choose_n_balls(int n, int num_types, int *count_per_type)
{
int total_count = 0;
for (int i = 0; i < num_types; i++) {
total_count += count_per_type[i];
}
if (n > total_count)
return 0;
@fulldecent
fulldecent / chriscms
Last active Jan 3, 2016
A knowledge management system we created in under 5 minutes
View chriscms
<?php
$title = "Knowledge Base 0.1";
$datadir = './data/';
if (!is_dir($datadir) || !is_writable($datadir)) die('The DATADIR directory must be writable');
$myurl='http://phor.net/PUB/chris/index';
?>
<html>
<head>
<title><?= $title ?></title>
View Swift chaining return success and failure
//: Playground - noun: a place where people can play
import UIKit
func delay(delay:Double, closure:()->()) {
dispatch_after(
dispatch_time(
DISPATCH_TIME_NOW,
Int64(delay * Double(NSEC_PER_SEC))
),
View encfs with exclude
# THIS IS A RAKEFILE
# NOTE: See .encfs6.xml file in this directory!
plaintext_dir = "/Volumes/FD Disk/"
filtered_dir = "/Volumes/FD Disk/FILTERED NOSYNC/"
ciphertext_dir = "/tmp/fd-disk-encrypted/"
backup_location = "root@camera.phor.net:/root/fd-disk-encrypted/"
backup_location_tmp = "root@camera.phor.net:/root/fd-disk-encrypted-tmpdelete/"
photo_dir = "/Volumes/FD Disk/media/my photos/"
View Villanova-student-photo-hack.php
<?php
# My hack from 2003, probably still works
$mail = $_GET['mail'];
if ($mail)
{
$image = "wildcardphotos/$mail.jpg";
if (!file_exists ($image))
{
$getURL="http://wildcardphotos.villanova.edu/servlet/ViewPhoto?mail=$mail";
View Researching UI Unit Tests in XCode
A view controller cannot segue to another controller without presenting itself.
https://stackoverflow.com/questions/8221787/perform-segue-on-viewdidload
https://stackoverflow.com/questions/10428629/programatically-set-the-initial-view-controller-using-storyboards
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
You can’t perform that action at this time.