Skip to content

Instantly share code, notes, and snippets.

@bryc
bryc / YamahaFM.md
Last active April 13, 2024 09:03
Collecting info on Yamaha FM soundchips
@soxofaan
soxofaan / README.md
Last active January 19, 2024 17:48
Simple pretty CSV and TSV file viewer.
@stwiname
stwiname / braintree.d.ts
Last active May 10, 2019 20:08
Typescript definition file for Braintree node module
//TODO update objects to show optional parameters
//TODO expand on Function parameters
//TODO add enum types
//TODO add error types
declare module Braintree {
/**********************
* Errors *
@libertylocked
libertylocked / fibonacci.asm
Created February 7, 2015 05:34
Fibonacci function in MIPS
.data
prompt1: .asciiz "Enter the sequence index\n"
prompt2: .asciiz "The Fibonacci value is:\n"
.text
# Print prompt1
li $v0, 4
la $a0, prompt1
syscall
@david-torres
david-torres / db_exists.js
Last active July 7, 2023 16:26
[mongo db_exists command] MongoDB command to check if a database exists. I use it with a puppet script to conditionally load up a database dump if one isn't detected. Useful for provisioning Vagrant. Returns with exit code zero if the database was found. #mongodb
function db_exists(db_name) {
db = db.getSiblingDB('admin');
db.runCommand('listDatabases').databases.forEach(function(db_entry){
if (db_entry.name == db_name) {
// quit with exit code zero if we found our db
quit(0);
}
});
// quit with exit code 1 if db was not found
@dcalacci
dcalacci / factorial.asm
Created September 19, 2012 03:35
simple factorial program in MIPS assembly
.globl main
.data
msgprompt: .word msgprompt_data
msgres1: .word msgres1_data
msgres2: .word msgres2_data
msgprompt_data: .asciiz "Positive integer: "
msgres1_data: .asciiz "The value of factorial("
msgres2_data: .asciiz ") is "
@codebrainz
codebrainz / c99.l
Created June 14, 2012 23:49
C99 Lex/Flex & YACC/Bison Grammars
D [0-9]
L [a-zA-Z_]
H [a-fA-F0-9]
E ([Ee][+-]?{D}+)
P ([Pp][+-]?{D}+)
FS (f|F|l|L)
IS ((u|U)|(u|U)?(l|L|ll|LL)|(l|L|ll|LL)(u|U))
%{
#include <stdio.h>