Skip to content

Instantly share code, notes, and snippets.

View seebs's full-sized avatar

seebs seebs

View GitHub Profile
[not mine, originally written by Cameron Purdy, but I can't seem to find a working link anymore.]
CP FTW!
https://www.quora.com/Have-you-worked-for-Thomas-Kurian-at-Oracle-He-is-the-new-CEO-of-Google-Cloud-What-is-he-like/answer/Cameron-Purdy
Have you worked for Thomas Kurian at Oracle? He is the new CEO of Google Cloud. What is he like?
Cameron Purdy
(require '[clojure.string :as str])
(import '(java.nio ByteBuffer))
(def testdata "00 05 61 61 61 61 61 00 05 61 61 61 61 61")
(defn parse [^ByteBuffer stream] nil)
(defn load-nbt-string
[^ByteBuffer stream]
(let [l (.getShort stream) data (byte-array l)]
/* I wrote this in 1990. I was at the time very proud of replacing two
* pages of Pascal code with an inner loop that was basically three lines.
*
* Today, I would... not do it this way.
* -seebs
*
* For meditation: http://thecodelesscode.com/case/13
*/
void
moveto(int *x, int *y, int tx, int ty) {
@seebs
seebs / log.c
Created May 18, 2021 16:35
homework answer
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <limits.h>
#include <stddef.h>
#include <math.h>
struct {
double lo, close;
@seebs
seebs / homework.c
Created February 7, 2020 04:39
someone asked for help with a homework problem. i was annoyed enough to give them a solution.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <limits.h>
#include <stddef.h>
#include <math.h>
struct {
double lo, close;
@seebs
seebs / bbcode
Created October 16, 2019 14:44
the forum-code source for my old "how to suck at city of heroes" post
[b][size=4]How to Suck at City of Heroes (and Villains)[/size][/b]
In most MMOs, experienced players know that there is no such thing as a bad group; there are only good groups, and funny groups. City of Heroes is afflicted with a player base many of whom are basically intelligent and friendly, meaning a lot fewer funny groups, which in turn denys us a lot of opportunities to rant on the forums. You can help. By learning to really suck at CoH, both game mechanically and socially, you can keep SG channels and global channels hopping with funny stories, giving other players the chance to bond as they commiserate.
This guide gives you an overview to key ways in which you can completely fail at many aspects of City of Heroes. I try to cover build advice, character design, interaction with other players, and more.
This guide is necessarily a work in progress, and I am deeply indebted to various pick-up groups for their contributions, feedback, and ongoing support.
[b][size=4]Section 1: Philosophy[/size][/b]
@seebs
seebs / c2.sh
Created May 30, 2019 16:59
A C interpreter as a shell script. Note, this is every bit as stupid as it sounds. The summer of 1995 was not a great time for good engineering decisions for me.
#!/bin/sh
# C interpreter in sh. Wow.
# Logic: we parse files, or arguments, or stdin.
# We see if we have exactly one argument that looks like a file. If so,
# we parse it. Otherwise, we look for arguments. Otherwise, we work on
# stdin.
ANSI="Y"
VERBOSE="N"
INCLUDES="stdio.h stdlib.h ctype.h"
@seebs
seebs / ttt.c
Created May 30, 2019 16:50
I apparently wrote this in 1996. I do not know how it works or why it works that way. I'm so sorry.
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* tic tac toe. we must draw reliably. */
enum players { x, o };
int turn = x;
@seebs
seebs / gist:58a7d32549dcd136dad09cb52fe277ad
Created December 6, 2018 02:36
someone asked me for help with their c homework once
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <limits.h>
#include <stddef.h>
#include <math.h>
struct {
double lo, close;
@seebs
seebs / go2_generic_feedback.md
Created August 29, 2018 15:16
contract design feedback for go2 generics

One question occurs me with regards to this example:

contract mappable(k K, _ V) { k == k }

Why not

contract mappable[_ K, _ V] { var _ map[K]V }

This would, I think, make the intent much clearer.