Skip to content

Instantly share code, notes, and snippets.

View zfogg's full-sized avatar
🔐
24BD65F25E5D7311F5FFB2D3EDDAE1DA7360D7F4

Zachary Fogg zfogg

🔐
24BD65F25E5D7311F5FFB2D3EDDAE1DA7360D7F4
View GitHub Profile
@zfogg
zfogg / asd.md
Created April 1, 2014 08:31
IDEA: Non-database MySQL implementations

A MySQL implementation that uses various weird backends to store the actual data (so anything except actual databases).

Basically a system where one writes an interface between MySQL queries, and some arbitrary (non-database) place to store and retrieve data.

Some ideas for initial interfaces:

  1. Embed data into jpegs and upload to imgur.
  2. Reddit comments and threads.
  3. A bunch of email accounts that send messages to each other.
  4. CSV files in Dropbox. (boring + obvious)

Keybase proof

I hereby claim:

  • I am zfogg on github.
  • I am zfogg (https://keybase.io/zfogg) on keybase.
  • I have a public key whose fingerprint is 20A5 A16B AFEA E60B C906 2612 EC96 825B 93D7 D925

To claim this, I am signing this object:

@zfogg
zfogg / myweechat
Last active August 29, 2015 14:04 — forked from pascalpoitras/config.md
# Encrypted password in sec.conf
/secure passphrase <pass>
/secure set bncpass <pass>
# Default setting for all network
@zfogg
zfogg / fizzbuzz.hs
Last active August 29, 2015 14:08
overly-complex fizzbuzz
mergeWords = zipWith (\x -> (++) x . (++) " ")
fizzs = tail . repeat $ "Fizz" : replicate 4 ""
buzzs = tail . repeat $ "Buzz" : replicate 2 ""
fizzBuzzs = tail . repeat $ "FizzBuzz" : replicate 14 ""
numbers = map ((:[]) . show) [0..]
main = mapM_ putStrLn $ tail $
map (last . words) . foldl1 mergeWords $
@zfogg
zfogg / CSVsToWorksheets.py
Created December 16, 2014 03:59
Convert a folder of CSVs into an Excel workbook, one worksheet per file.
#!/usr/bin/python
"""CSVsToWorksheets.py: takes a folder of CSVs and puts them into a single Excel workbook, one worksheet per file."""
__author__ = "Zach Fogg"
__email__ = "zach@wearableintelligence.com"
import xlwt, csv, os
@zfogg
zfogg / UnitCircle.cs
Created June 21, 2011 18:52
Unit Circle
using System;
using System.Collections.Generic;
namespace Bounce
{
public class UnitCircle
{
public UnitCircle()
{
pi = Math.PI;
for (int i = 0; i < PhysicalSprites.Count; i++)
{
if (PhysicalSprites[i].IsAlive)
PhysicalSprites[i].Update(gameTime);
else
{
PhysicalSprites[i].Body.Dispose();
PhysicalSprites.RemoveAt(i);
i--;
}
public static List<Body> CreateFraming(World world, int width)
{
List<Body> bodyList = new List<Body>();
float x = WindowSize.X;
float y = WindowSize.Y;
for (float i = 0f; i <= x; i += x)
{
for (float j = 0f; j <= y; j += y)
{
@zfogg
zfogg / pyth_triplets.hs
Created April 5, 2012 03:24
Finding Pythagorean Triplets
import Data.List
import System.Environment
isPythTriplet :: (Integer, Integer, Integer) -> Bool
isPythTriplet (a, b, c) = (a^2) + (b^2) == (c^2)
-- All possible representations of three elements from xs,
-- where let xs[x] = indexof x in xs[a] < xs[b] < xs[c].
triplets :: [Integer] -> [(Integer, Integer, Integer)]
triplets xs = [ (a, b, c) | a:as <- tails xs,
def membersOfType(o, *types):
return dict(
[(m, a)
for m, a in map(lambda x: (x, getattr(o, x)), dir(o))
if any([isinstance(a, t) for t in types])])