Skip to content

Instantly share code, notes, and snippets.

View drhodes's full-sized avatar

Derek Rhodes drhodes

View GitHub Profile
@drhodes
drhodes / word_show.asm
Last active December 21, 2015 16:19
uasm assembly for printing a word in memory to the console
.include "beta.uasm"
.options tty
ADDC(SP, 0x800, SP) // allocating
BEQ(R31, main, R31) // goto main
. = . + 0x800
main:
ADDC(R31, 0x100, SP) // Set stack pointer
waddr = R1
ADDC(R31, 0x1000, waddr) // point waddr to array
PUSH(waddr) // pushing argument reverse order
#!/usr/bin/env bash
# thanks for the helpful blog post @
# https://paulbradley.org/video-to-animated-gif/
avconv -i $1 -r 10 -pix_fmt rgb24 -f gif - | gifsicle --optimize=9 --delay=10 --loopcount > $1.gif
@drhodes
drhodes / gist:8b93ccb3d00ad44c286b
Created November 3, 2015 05:12
embedding a github gist on the edx forum
Hello
@drhodes
drhodes / gist:8a528fe5ee8085d6597e
Created October 22, 2015 21:35
coursenotes2url.py
#!/usr/bin/env python
import argparse
URL_TEMPLATE = "http://computationstructures.org/notes/%s/notes.html#TARGET_"
# takes a section number like 6.5.4 and converts it to a URL
def section_to_url(chapter, section):
lookup = {
'3': "information",
'4': "circuits",
<link rel="import" href="../core-drawer-panel/core-drawer-panel.html">
<link rel="import" href="../core-input/core-input.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-scroll-header-panel/core-scroll-header-panel.html">
<link rel="import" href="../paper-toast/paper-toast.html">
<link rel="import" href="../google-map/google-map.html">
<link rel="import" href="../code-mirror/code-mirror.html">
<polymer-element name="my-element">
function _square($0$0, $0$1) {
var label = 0;
var __stackBase__ = STACKTOP; STACKTOP = (STACKTOP + 32)|0; assert((STACKTOP|0) < (STACK_MAX|0));
var $__make_return_pointer=__stackBase__;
var $__llargbundle=(__stackBase__)+(8);
var $1=(__stackBase__)+(24);
var $2=(($__llargbundle)|0);
var $st$0$0=(($2)|0);
HEAP32[(($st$0$0)>>2)]=$0$0;
var $st$1$1=(($2+4)|0);
enum Shape {
Circle {
radius: float
},
NoShape,
}
fn main() {
let mut c = Circle{radius: 5.0};
match c {
@drhodes
drhodes / main.go
Created October 4, 2012 03:11
crashing pq by specifying runtime.GOMAXPROCS
package main
import (
_ "github.com/bmizerany/pq"
//"runtime"
"database/sql"
"log"
"math/rand"
)
@drhodes
drhodes / gist:3461123
Created August 25, 2012 05:14
Type annotated file positions
$ cat hello.rs
fn main() {
let temp = 0;
io::println(~"Hello world!");
}
$ rustc --pretty pos ./hello.rs | typelist.py
<intrinsic> 12 8 12 30 fn() -> *()
@drhodes
drhodes / lolcate.sh
Last active April 13, 2020 14:32
lolcate, comically fast file locater sometimes two orders of magnitude faster than mlocate
#!/bin/bash
# Please read to make sure you really want to use this program
# it hasn't been tested.
# Requires lzop
mkdir -p ~/.lolcate
case "$1" in