This file contains 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 <stdlib.h> | |
#include <complex.h> | |
int main(int argc, char* argv[]) | |
{ | |
float _Complex number = 1 + (1 * _Complex_I); | |
printf("%g, %g", cabs(number), carg(number)); |
This file contains 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 <stdlib.h> | |
#include <stdio.h> | |
#include <gmp.h> | |
/** | |
* Compute a Factorial | |
* | |
* returns a string representation of the number `n` in base 10. | |
*/ |
This file contains 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 <stdlib.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <inttypes.h> | |
#include "timer.h" | |
struct aligned { | |
uint32_t o:8; | |
uint32_t d:8; |
This file contains 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 | |
import sys | |
import subprocess | |
import tempfile | |
import time | |
# Emacs is in the Cellar, installed by Homebrew | |
emacspath="/usr/local/Cellar/emacs/24.3/Emacs.app/Contents/MacOS/Emacs" | |
def run(cmd, args): |
This file contains 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/ruby | |
require 'wiringpi' | |
require 'net/ping' | |
require 'syslog' | |
# Constants | |
OUTPUT_PINA = 0 # RPi Pin 11 | |
OUTPUT_PINB = 1 # RPi Pin 12 | |
ARM_ON_TIME = 0.1 |
This file contains 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 bash | |
# Touch any files that don't exist | |
for file in "$@" | |
do | |
echo "$file" | |
if [ ! -a "$file" ]; then | |
touch "${file}" | |
fi | |
if [ ! -w "$file" ] || [ ! -r "$file" ]; then |
This file contains 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
class Namespace(object): | |
"""Namespace | |
Represents a read-only access to a dictionary through the . operator. Used | |
to allow easy access to options and suchlike. Should be both Python 2.7 and | |
3.x compatible. | |
""" | |
def __init__(self, dict): | |
self.__dict__.update(dict) |
This file contains 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 <stdlib.h> | |
#include <errno.h> | |
#include <string.h> | |
#include <openssl/ripemd.h> | |
int main(int argc, const char* argv[]) { | |
FILE* file; | |
int length; | |
unsigned char* buffer; |
This file contains 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 | |
require 'pathname' | |
def find_config_file(file_name, path) | |
path = Pathname(path) unless path.is_a? Pathname | |
path = path.realpath | |
path.ascend do |subpath| | |
location = subpath + file_name |
This file contains 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
;; Defines a simple generic mode to hilight lasm files | |
(define-generic-mode 'lasm-mode | |
;; Comment start marker, we just do single line comments for now | |
'("//") | |
;; Keywords, these are just taken verbose from opslist.h | |
'("pushloc" "pusharg" "pushlitn" "pushlitd" "pushlits" "pushtrue" "pushfalse" | |
"pushnull" "pushident" "poploc" "poparg" "dup" "pop" "idlook" "ntod" "ntos" | |
"dtos" "btos" "xton" "xtod" "xtob" "xtos" "add" "sub" "mul" "div" "mod" | |
"pow" "log" "neg" "inc" "dec" "cat" "slice" "strchar" "strcmp" "lt" "lteq" | |
"gt" "gteq" "eq" "noteq" "not" "and" "or" "print" "jump" "jumpt" "jumpf" |