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
#!/bin/bash | |
# Check if a file argument is provided | |
if [ $# -ne 1 ]; then | |
echo "Usage: $0 <hex-file>" | |
exit 1 | |
fi | |
FILE_PATH=$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
#ifndef BITMAP_H | |
#define BITMAP_H | |
#include <stdint.h> | |
#include <stdbool.h> | |
#include <stdlib.h> | |
#include <string.h> | |
typedef uint32_t bitmap_t; |
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 node | |
const https = require("https"); | |
const config = require(process.argv[2]); | |
function durationString(target) { | |
const msPerMinute = 60 * 1000; | |
const msPerHour = msPerMinute * 60; | |
const msPerDay = msPerHour * 24; |
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
#!/bin/bash | |
# monitor.sh - Monitors a web page for changes | |
# sends a Pushover notification if it changes | |
if [[ $# -ne 3 ]]; then | |
echo "Usage: $0 <url> <token> <user>" >&2 | |
exit 2 | |
fi |
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 <mpi.h> | |
#include <assert.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <math.h> | |
#define SIZEX 2000 | |
#define SIZEY 2000 | |
#define IDX(a, x, y) a[(x) + (y) * (size_x + 2)] |
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
# Encoding and parsing integers | |
# https://docs.python.org/3/library/stdtypes.html#int.to_bytes | |
# https://docs.python.org/3/library/stdtypes.html#int.from_bytes | |
bytes = (42).to_bytes(2, 'big') # 16-bit integer, big-endian | |
num = int.from_bytes(bytes, 'big') # Notice: length is implicit | |
# Encoding and parsing strings | |
# https://www.programiz.com/python-programming/methods/string/encode | |
bytes = "Hello, World!".encode() | |
string = b"Hello, World!".decode() |
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
html, body { | |
padding: 2.5em; | |
margin: auto; | |
max-width: 48em; | |
} | |
body { | |
font: 0.8em Palatino, Times; | |
color: #333; | |
line-height: 1.3; |
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
/* | |
* ================================= | |
* SPCA: Cheatsheet for Assignment 3 | |
* Carl Friess | |
* ================================= | |
*/ | |
// Reading arguments | |
// Example: $ nano myfile.txt |
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/local/bin/node | |
const readline = require('readline'); | |
var exec = require('child_process').exec; | |
var path = require('path'); | |
const rl = readline.createInterface({ | |
input: process.stdin, | |
output: process.stdout | |
}); |
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
function update(obj) { | |
for (var i=1; i<arguments.length; i++) { | |
for (var prop in arguments[i]) { | |
var val = arguments[i][prop]; | |
if (Object.prototype.toString.call(val) === '[object Array]') { //Array | |
obj[prop] = []; | |
update(obj[prop], val); | |
} | |
else if (typeof val == 'object' && !(val instanceof Date) && val != null) { //Object | |
if (typeof obj[prop] != 'object' || obj[prop] == null) { |