This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Comple with g++ *.cpp -o prog // | |
#include <iostream> | |
#include "test.h" | |
using namespace std; | |
int main(int argc, char **argv){ | |
Test test; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdint.h> | |
//// Create some pretend Memory Mapped Registers | |
volatile uint64_t memory_mapped_registers[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; | |
#define bit_depth uint64_t | |
#define mmio_byte(mem_addr) (*(volatile bit_depth *)(mem_addr)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/usr/bin/env python | |
from sys import stdout | |
from math import pi, log10, pow | |
Tau = 2 * pi | |
TableWidth = 20 | |
## Calculate Decibels | |
def db(ref, val): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//// | |
// Curiously Recurring Template Pattern | |
#include <stdio.h> | |
template <typename T> | |
struct Counter { | |
// Static class members variables | |
static int objects_created; | |
static int objects_alive; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
//// | |
// Pattern match on a list of types, recursively ask for the last one | |
template <typename Head, typename... Tail> | |
struct last { | |
using type = typename last<Tail...>::type; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use readline) | |
(current-input-port (make-readline-port)) | |
(install-history-file #f ".csi.history") | |
(parse-and-bind "set editing-mode vi") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;; RC Filter Simulation | |
;; Calculates the frequency response of an RC filter | |
;; and displays it with ASCII art | |
;; This is just a program I always write to learn a new programming language | |
;; I tried out Scheme's lazy lists for this | |
;; | |
;; Frequency Response | |
;; ---------------------------------------------------------------- | |
;; |****************************** | | |
;; | ***** | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdint.h> | |
#include <stdlib.h> | |
#include <stdbool.h> | |
#include <string.h> | |
#define NICKNAMED(x) ((x & 0x80000000) >> 31) | |
#define IS_EGG(x) ((x & 0x40000000) >> 30) | |
#define SP_DEF_IV(x) ((x & 0x3e000000) >> 25) | |
#define SP_ATT_IV(x) ((x & 0x01f00000) >> 20) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Compile with: g++ -std=c++11 variadic_print.cpp -o variadic_print | |
#include <iostream> | |
// No argument case | |
void print() {} | |
// Recursive Variadic Template | |
template <typename HEAD, typename ... TAIL> | |
void print(const HEAD& head, const TAIL& ... tail) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Really inefficient toy | |
#### | |
## A little wrapper to make signals either with | |
## lambda functions or arrays. | |
class SignalFunction | |
def self.ramp | |
SignalFunction.new(lambda{|n| n < 0 ? 0r : n/1r}) | |
end |