Skip to content

Instantly share code, notes, and snippets.

View yoshw's full-sized avatar

Yoshua Wakeham yoshw

View GitHub Profile

Keybase proof

I hereby claim:

  • I am yoshw on github.
  • I am ywakeham (https://keybase.io/ywakeham) on keybase.
  • I have a public key ASCkBr3T_SjZP1usiy8REi2lso0jHA8Zy2hB89g677naawo

To claim this, I am signing this object:

@yoshw
yoshw / card.py
Created September 13, 2016 08:21
from enum import Enum, IntEnum
class Suit(Enum):
clubs = 1
diamonds = 2
hearts = 3
spades = 4
def __repr__(self):
suit_icons = "♣♢♡♠"
@yoshw
yoshw / dasgupta2-17.c
Last active January 1, 2024 13:24
Dasgupta et. al., problem 2.17
// An attempted solution to the following problem:
// Given a sorted array of distinct integers A[1, . . . , n],
// you want to find out whether there is an index i for which A[i] = i.
// Give a divide-and-conquer algorithm that runs in time O(log n).
// Taken from 'Algorithms', by S. Dasgupta, C. H. Papadimitriou, and U. V. Vazirani, 2006.
// NB. It would be easy enough to implement this with a while loop,
// but since the questions asks for a D&C solution, explicit
/*
** Draw Maze as ascii
*/
void
drawMaze(Graph *g, int n) {
int side_length = 2*n+1;
char wall = '%';
char passage = ' ';
char ascii_maze[side_length][side_length];
@yoshw
yoshw / info20003_snippet1.sql
Last active August 29, 2015 14:05
SQL Skills Learn by Example – Query 18
SELECT DISTINCT
ItemName
FROM
Item
INNER JOIN
Delivery ON Delivery.ItemID = Item.ItemID
# Where the item has been delivered by a supplier which delivers
# all items of type N
WHERE
SupplierID IN (SELECT DISTINCT