Skip to content

Instantly share code, notes, and snippets.

View adamnew123456's full-sized avatar

Chris Marchetti adamnew123456

  • Chapel Hill, NC
View GitHub Profile
@adamnew123456
adamnew123456 / evilscan.py
Created April 16, 2014 00:22
Scans Images From HP 3050... Using Lambdas
# So, this is a port of a fairly simple script from "normal Python" to "pure-lambda
# Python". This code contains no Python statements, and is a proof-of-concept to show
# what you can do without statements, and how powerful Python's lambdas are despite
# that they are crippled.
#
# A few notes on how to read this:
# 1. Almost everything happens in the arguments. Practially nothing happens
# inside function bodies, since the function bodies are usually just other
# functions. Go down to the bottom of the expression (using your editor's
# paren matching) to see what the arguments are.
@adamnew123456
adamnew123456 / bf-compiler.py
Last active August 29, 2015 14:06
A BrainFuck Compiler For NASM/DOSBox
"""
Compiles BrainFuck programs into x86 assembly.
Supported operators:
> < + - [ ] . ,
Note that this doesn't support Linux for simplicity, and is instead targeted
at DOSBox (due to the fact that Linux buffers stdio while DOSBox does not).
"""
@adamnew123456
adamnew123456 / image-preview.user.js
Last active August 29, 2015 14:07
Inline Preview of Images on Reddit
// ==UserScript==
// @name Image Preview.
// @namespace adamnew123456@gmail.com
// @description Adds inline previews of images on Reddit.
// @include http://www.reddit.com/r/*
// @include http://reddit.com/r/*
// @include http://www.reddit.com/
// @include http://www.reddit.com/?*
// @include http://reddit.com/
// @include http://reddit.com/?*
@adamnew123456
adamnew123456 / eqnmix.html
Last active August 29, 2015 14:10
A Simple Equation Mixer
<html>
<title> Equation Mixer </title>
<body>
<canvas id="grid" width="600" height="600"> </canvas> <br/>
f(x): <input id="func1" type="text" value="Math.sin(x)"> </input>
g(x): <input id="func2" type="text" value="Math.cos(x)"> </input> <br/>
X Min: <input id="xmin" type="text" value="-1"> </input>
X Max: <input id="xmax" type="text" value="1"> </input> <br/>
@adamnew123456
adamnew123456 / parametric.html
Created December 2, 2014 17:23
A Simple Parametric Equation Grapher
<html>
<title> Equation Mixer </title>
<body>
<canvas id="grid" width="600" height="600"> </canvas> <br/>
x(t): <input id="func_x" type="text" value="Math.sin(t)"> </input>
y(t): <input id="func_y" type="text" value="Math.cos(t)"> </input> <br/>
X Min: <input id="xmin" type="text" value="-1"> </input>
X Max: <input id="xmax" type="text" value="1"> </input> <br/>
@adamnew123456
adamnew123456 / mop.js
Last active August 29, 2015 14:11
A Javascript Meta-Object System, Modelled On Python's OO
/**
* A small meta-object protocol for describing a Python-like class system in
* Javascript.
*
* In this MOP, objects are (at bottom) represented as a mapping of three things:
*
* - a list of parent classes
* - a list representing the object's MRO
* - a mapping of attribute names to attributes
*
@adamnew123456
adamnew123456 / wikiword.py
Created January 5, 2015 17:00
WikiWord - A Static Wiki-Like Site Generator
"""
Converts a tree of wiki pages into a tree of HTML pages.
"""
from collections import defaultdict
import configparser
import glob
import itertools
import os, os.path
import re
import shutil
@adamnew123456
adamnew123456 / usm
Created April 5, 2015 17:28
USM Fix
#!/bin/sh
set -u
USAGE='Usage: usm COMMAND ...
usm help
usm init
usm copy-script
usm add SOFTWARE VERSION
usm set-current SOFTWARE VERSION
<canvas id="canvas" width="600" height="600">
</canvas> </br>
Method: <input id="algorithm" type="text"> </input> <br/>
Timestep (Hz): <input id="timestep" type="text"> </input> <br/>
<input id="start_stop" type="button" value="Start" onclick="run()"> </input> <br/>
<script>
////////////////////
var PERSON_RADIUS = 1;
var PERSON_SPEED = 5;
@adamnew123456
adamnew123456 / fizzbuzz.s
Created May 13, 2015 20:59
FizzBuzz In x86 Assembly
// FizzBuzz in x86 assembly - written on 32-bit Linux using the GNU ASsembler
.data
FIZZSTR:
.asciz "Fizz"
BUZZSTR:
.asciz "Buzz"
NEWLINE:
.asciz "\n"
// strtoa stores its data here. Since FizzBuzz runs 1-100, it won't need more than 3 bytes