Skip to content

Instantly share code, notes, and snippets.

@pathawks
pathawks / GCC Options-en.md
Last active August 29, 2015 14:15
Common GCC Options
Option Explanation
-o <OutputFile> Specify name of output file
-Wall Shows all warning messages
-Wextra Shows even more warning messages
-g Include debug information in output (For debugging with gdb)
-gstabs Include debug information in output (-g is preferred)
-c Do not link; output object file (Does not produce .exe)
-S Do not assemble; output assembler code.
-O0 Do not optimize output (Useful for debugging)
@pathawks
pathawks / CHALLEN1.BAS
Last active August 29, 2015 14:15
Programming Challenge 1
REM To run:
REM 1. Get a time machine
REM 2. Travel back to the early 90s
REM 3. In MS-DOS 5+, run `qbasic /run CHALLEN1.BAS`
10 PRINT "Enter a whole number between 1000 and 999999 without spaces or commas."
20 INPUT "", N&
30 IF N& < 1000 OR N& > 999999 THEN GOTO 10
40 PRINT LTRIM$(STR$(INT(N& / 1000)));
50 PRINT ",";
@pathawks
pathawks / Test.cpp
Last active August 29, 2015 14:16
Test Framework
/**
* @author: Pat Hawks
* Created on: Feb 26, 2015
* Source File: Test.cpp
*/
#include <iomanip>
#include <iostream>
#include <string>
using namespace std;
@pathawks
pathawks / Challenge2.S
Last active August 29, 2015 14:16
Challenge 2
/**
* @author: Pat Hawks
* Created on: Mar 06, 2015
* Source File: Challenge2.s
*
* To compile:
* gcc Challenge2.s -o Challenge2
*/
.code32
@pathawks
pathawks / ieeefloat.c
Last active September 30, 2015 03:47
IEEE 754 Explore
/**
* Shows how a number is represented as IEEE 754
*
* @author Pat Hawks
* Course: COMP B13
* Created: Sept 29, 2015
* Source File: ieeefloat.c
*/
#include <stdio.h>
@pathawks
pathawks / 99Bottles.s
Last active October 5, 2015 00:23
99 Bottles of Beer in MIPS
# filename: 99Bottles.s
# author: Pat Hawks <pat@pathawks.com>
.data
Lyric1:
.asciiz " bottles of beer on the wall\n"
Lyric2:
.ascii " bottles of beer\n"
.asciiz "Take one down, Pass it around\n"
Lyric3:
@pathawks
pathawks / Swift.md
Last active February 19, 2016 22:09
I ❤️ Swift

I ❤️ Swift

📜 View The Slides

About Swift Philosophy

Swift is friendly to new programmers. It is the first industrial-quality systems programming language that is as expressive and enjoyable as a scripting language.

The compiler is optimized for performance, and the language is optimized for development, without compromising on either. It’s designed to scale from “hello, world” to an entire operating system.

@pathawks
pathawks / index.js
Last active April 9, 2016 04:28
Slack Google slash command
const qs = require('querystring');
const https = require('https');
const url = require('url');
const googleLink = function (text) {
const query = encodeURIComponent(text).replace(/%20/g,'+');
return "<https://www.google.com/search?q=" + query + "|google.com/search?q=" + query + ">";
}
const qrCode = function (url) {
(set-info :smt-lib-version 2.6)
(set-logic QF_LIA)
(set-option :produce-models true)
(set-info :status sat)
(declare-const board11 Int)(assert (= 1 board11))
(declare-const board12 Int)(assert (= 9 board12))
(declare-const board13 Int)(assert (and (<= 1 board13)(<= board13 9)))
(declare-const board14 Int)(assert (and (<= 1 board14)(<= board14 9)))
(declare-const board15 Int)(assert (and (<= 1 board15)(<= board15 9)))
(declare-const board16 Int)(assert (and (<= 1 board16)(<= board16 9)))
@pathawks
pathawks / extract_tandy_vgm.py
Last active August 1, 2026 17:04
Extract Fire Hawk
#!/usr/bin/env python3
"""Extract Fire Hawk's Tandy/PCjr and Sound Blaster soundtracks as VGM files.
The DOS release stores each song as an LSB-first Sierra LZW resource named
SSnnn. Every unpacked sound resource contains several hardware-specific
tracks. This converter selects track 0x13 for the three-voice PCjr/Tandy
versions and track 0x08 for the nine-voice Sound Blaster OPL2 versions. It
uses the matching PATCH.101 and PATCH.003 data and models the respective
Sierra music-driver register writes.