Skip to content

Instantly share code, notes, and snippets.

View subnomo's full-sized avatar
🏠
Working from home

Alex Taylor subnomo

🏠
Working from home
View GitHub Profile
@subnomo
subnomo / delete_cliffs.lua
Created February 25, 2020 08:10
Factorio script - Deletes all cliffs within 250 units
local surface = game.player.surface
local pp = game.player.position
local count = 0
for key, entity in pairs(surface.find_entities_filtered({ type="cliff", radius=250, position=pp })) do
count = count + 1
entity.destroy()
end
game.player.print(string.format('Destroyed %d cliffs!', count))
@subnomo
subnomo / Cargo.toml
Created October 6, 2018 11:44
Donut - donut.c ported to Rust
[package]
name = "donut"
version = "0.1.0"
authors = ["Alex Taylor <alex@subnomo.me>"]
[dependencies]
time = "0.1.37"
@subnomo
subnomo / final.asm
Last active September 12, 2023 01:49
TITLE Combinations Calculator (final.asm)
; Author: Alexander Taylor
; CS 271 Sec. 1 / Program 6B Date: 12/04/16
; Description: This program generates practice combinations problems.
; It takes user input for each problem, and tells the user
; the answer, as well as if they were right or wrong. Finally,
; it implements extra credit #1 by keeping track of each answer,
; and tallying up the number of right and wrong at the end.
@subnomo
subnomo / pow.asm
Last active April 1, 2020 03:43
A power macro written in MASM
pow MACRO x, n
LOCAL start
push ebx
push ecx
push edx
mov eax, x
mov ebx, eax
mov ecx, n
@subnomo
subnomo / array_includes.ts
Created November 28, 2016 08:15
Array.prototype.includes polyfill for TypeScript
declare global {
interface Array<T> {
includes(searchElement: T): boolean;
}
}
if (!Array.prototype.includes) {
Array.prototype.includes = (searchElement: any, ...args: number[]) => {
if (this == null) {
throw new TypeError("Array.prototype.includes called on null or undefined");
@subnomo
subnomo / SimpleMemory.cpp
Last active September 13, 2018 16:15
SimpleMemory - A C++ class to simplify reading and writing to the memory of programs (e.g. games)
#include "SimpleMemory.h"
SimpleMemory::SimpleMemory(std::wstring windowName) {
hwnd = FindWindowW(nullptr, windowName.c_str());
DWORD pid;
GetWindowThreadProcessId(hwnd, &pid);
hProcess = OpenProcess(PROCESS_VM_READ | PROCESS_VM_WRITE | PROCESS_VM_OPERATION, false, pid);
}
@subnomo
subnomo / trait_overload.rs
Created September 30, 2016 16:03
How to overload functions in Rust using traits. Updated from source - https://goo.gl/StPQ1B
struct Foo {
value: u32
}
trait HasUIntValue {
fn as_uint(self) -> u32;
}
impl Foo {
fn add<T: HasUIntValue>(&mut self, value: T) {
@subnomo
subnomo / keybase.md
Last active March 1, 2016 13:23
Keybase proof ...stuff

Keybase proof

I hereby claim:

  • I am subnomo on github.
  • I am subnomo (https://keybase.io/subnomo) on keybase.
  • I have a public key ASCFG6v7ynKKvj4MwoqCo_jxc3z3Ulv9NxME9mwB7oTrLQo

To claim this, I am signing this object:

@subnomo
subnomo / SimpleJSON.cs
Last active October 16, 2016 06:33
SimpleJSON from http://wiki.unity3d.com/index.php/SimpleJSON with added support for long datatype
//#define USE_SharpZipLib
#if !UNITY_WEBPLAYER
#define USE_FileIO
#endif
/* * * * *
* A simple JSON Parser / builder
* ------------------------------
*
* It mainly has been written as a simple JSON parser. It can build a JSON string
* from the node-tree, or generate a node tree from any valid JSON string.
@subnomo
subnomo / tinder-api-documentation.md
Last active August 29, 2015 14:26 — forked from rtt/tinder-api-documentation.md
Tinder API Documentation

Tinder API documentation

http://rsty.org/

I've sniffed most of the Tinder API to see how it works. You can use this to create bots (etc) very trivially. Some example python bot code is here -> https://gist.github.com/rtt/5a2e0cfa638c938cca59 (horribly quick and dirty, you've been warned!)

Note: this was written in April/May 2014 and the API may have changed since

API Details