Skip to content

Instantly share code, notes, and snippets.

@briangordon
briangordon / list-processes.ps1
Last active June 3, 2017 23:48
Short PowerShell snippet I wrote for repeatedly dumping all running processes less than a minute old to a file
while($true) {
Get-Process | ? {$_.StartTime -gt (Get-Date).AddMinutes(-1)} | Select-Object ProcessName,Description,Path >> out.txt
sleep 0.01
}
@briangordon
briangordon / wolfenstein-the-old-blood-headers.txt
Last active March 27, 2016 01:45
I attached a debugger to a running Wolfenstein: The Old Blood process and found this in memory. I have no idea why it's there.
This file has been truncated, but you can view the full file.
CHEATENGINE `êcžö áÏ Ð|¤ö generic unknown error KÊžö Px¤ö ¤ö P~¤ö  |¤ö °|¤ö Ð|¤ö iostream iostream stream error  KÊžö Px¤ö 0¤ö  ~¤ö `|¤ö °|¤ö Ð|¤ö system invalid string position string too long specularPowers bool aiEditable.actionSettings.taunt.tauntMinInterval float * aiConstants.physics.clipMask.shotClip probability int maxLookAngles idVec2 weaponVars.burstWaitTime int swapParticle float bool float onSprinting * idAngles int staticSpecularVector idDeclParticle bool aiEditable.movement.usesSmoothAnimSearch int aiEditable.targeting.spottedMax idVec3 specularScales bool aiEditable.actionSettings.taunt.tauntMaxInterval float int aiConstants.physics.clipMask.ikClip int minIdleTime int howLongToHold idVec2 weaponVars.randomness destroyParticle float bool onShooting int additiveBlendLight * idDeclParticle bool aiEditable.movement.usesSmoothAnimCombat * aiEditable.ta
@briangordon
briangordon / eve-pathfinder.cpp
Last active January 3, 2017 19:43
My improved version of MagicalTux's EVE online path finder.
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <unordered_map>
#include <sys/time.h>
// We specify the total number of systems explicitly so that we can initialize data structures before reading in the whole csv file.

Keybase proof

I hereby claim:

  • I am briangordon on github.
  • I am brian (https://keybase.io/brian) on keybase.
  • I have the public key with fingerprint 41AA 1387 FA3D 5EAC 4F4B  18EE AE46 EFC0 2F3E 2BA8

To claim this, I am signing this object:

@briangordon
briangordon / gist:8869639
Created February 7, 2014 19:09
English word frequencies
a,10144200
abandon,15323
ability,51476
able,103171
abortion,18925
about,208550
above,23866
abroad,8788
absence,13597
absolute,9622
@briangordon
briangordon / gist:8656177
Created January 27, 2014 20:04
Encapsulation in JavaScript
function MyClass () {
var privateVariable = 5;
var privateMethod = function () {
return privateVariable;
};
this.publicMethod = function () {
return privateMethod();
}
}
P r o g r a m m i n g - a - M o d e - F i n d e r
-a guide to programming a mode finder-
By: Brian Gordon
____________
/Introduction\_________________________________
| |
|This guide will outline the technique I found |
|is the best way to determine a mode from a |
|set of data. It includes most of the source |
|code from the original program, then explains |
@briangordon
briangordon / Regex challenge
Last active December 20, 2015 18:29
This is a speed run. It's not how I would implement a more fully-featured regex engine. I was tripped up by a couple of bugs so the first one took me a total of 90 minutes to write. Later I had an idea for a simpler version that doesn't work in all cases. It took me 25 minutes to write.
Consider the subset of regular expressions that only use lowercase letters, parentheses, and the Kleene star *.
The presence of a Kleene star means that the preceding parenthesized phrase can appear zero or more times.
Parentheses are only valid around the text preceding a Kleene star. Write a program that takes such a regular
expression and a string and determines whether or not that entire string matches the regular expression.
For example, the string on the left matches the regular expression on the right:
hello hello
testtest (test)*
helllllllo he(l)*lo
interface Condiment {}
interface Ketchup extends ISuper {}
// This is a covariant interface
interface Kitchen<T extends Condiment> {
public void squirtCondiment(T covariant);
}
// This implements the Kitchen interface even though the implementation refers specifically to Ketchup in the type signature
class KetchupKitchen implements Kitchen<Ketchup> {
@briangordon
briangordon / gist:5374626
Created April 12, 2013 19:51
From Oracle's Class.java
/**
* Add a package name prefix if the name is not absolute Remove leading "/"
* if name is absolute
*/
private String resolveName(String name) {
if (name == null) {
return name;
}
if (!name.startsWith("/")) {
Class<?> c = this;