Skip to content

Instantly share code, notes, and snippets.

View fulldecent's full-sized avatar

William Entriken fulldecent

View GitHub Profile
<?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";
<?php
#
# Input multiple SELECT statements from different SQL queries
# get back a single stream of rows with records merged if
# they have the same key
#
function genOneTwoThree() {
foreach ([1=>'one',2=>'two',3=>'three'] as $key => $value) {
# echo "...ready to yield: $key => $number\n";
//: 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))
),
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 {
// 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;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct node {
int value;
struct node *left;
struct node *right;
} node;
# 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/"
##
## backup-to-insecure-remote-server v1.0
## William Entriken / github.com@phor.net
##
## YOU NEED TO KEEP A BACKUP OF .encfs6.xml AND YOUR PASSKEY!!!
##
## TODO
## * Create a restore action
## * Make a quick task to confirm that restoring works
##
@fulldecent
fulldecent / fen2html.html
Last active May 31, 2023 12:28
Paste in a Chess FEN position to get a board representation in HTML
<!-- COPIED FROM https://phor.net/gadgets/fen2html/ -->
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<title>FEN2HTML</title>
<style>
table.chess { border: 1px solid black; margin: 2px; font-size: xx-large}
@fulldecent
fulldecent / chriscms
Last active January 3, 2016 17:59
A knowledge management system we created in under 5 minutes
<?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>