Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am MatthaeusHarris on github.
  • I am matthaeus (https://keybase.io/matthaeus) on keybase.
  • I have a public key whose fingerprint is 5CA4 F9D3 FD31 452C 4586 F29D 6302 355C DC4F BDBA

To claim this, I am signing this object:

@MatthaeusHarris
MatthaeusHarris / firmware.js
Created December 1, 2014 06:55
RTC Clock POC
var LCD = {};
LCD.connect = function(/*=SPI*/_spi, /*=PIN*/_dc, /*=PIN*/_ce, /*=PIN*/_rst, callback) {
var LCD = Graphics.createArrayBuffer(84,48,1,{vertical_byte:true});
var spi = _spi;
var dc = _dc;
var ce = _ce;
var rst = _rst;
setTimeout(function() {
digitalWrite(dc,0); // cmd
digitalPulse(rst, 0, 10); // pulse reset low
var a = function(b) {
return function(c) {
return b*c;
}
}
var makeLogger = function(level) {
return function(message) {
console.log(level + ": " + message);
}
}
var warn = makeLogger('warn');
var err = makeLogger('err');
var info = makeLogger('info');
@MatthaeusHarris
MatthaeusHarris / preload.js
Last active October 21, 2015 21:27
Javascript Preloader
function preload(urls, callback) {
console.log("Setting up preload");
// Container for the actual images
var images = [];
// List of images already loaded
var loaded = {};
// Initialize loaded array to all false
var feed_url = "http://dragonfinsoup.com/wp/wordpress/?json_route=/posts";
var data;
var masterTemplate;
var fetchPosts = function(num, offset) {
if (!masterTemplate) {
masterTemplate = $('.blogEntry').first().clone();
}
if (!data) {
@MatthaeusHarris
MatthaeusHarris / gist:128e53aacd74d83c6d3a
Created February 9, 2016 09:54
Proxmox LXC hang on backup
root@tiamat:~# ps faxo f,uid,pid,ppid,pri,ni,vsz,rss,wchan:20,stat,tty,time,comm | tee ps.log
F UID PID PPID PRI NI VSZ RSS WCHAN STAT TT TIME COMMAND
1 0 2 0 19 0 0 0 kthreadd S ? 00:00:00 kthreadd
1 0 3 2 19 0 0 0 smpboot_thread_fn S ? 00:00:02 \_ ksoftirqd/0
1 0 5 2 39 -20 0 0 worker_thread S< ? 00:00:00 \_ kworker/0:0H
1 0 7 2 19 0 0 0 rcu_gp_kthread S ? 00:03:19 \_ rcu_sched
1 0 8 2 19 0 0 0 rcu_gp_kthread S ? 00:00:00 \_ rcu_bh
1 0 9 2 19 0 0 0 rcu_nocb_kthread S ? 00:02:00 \_ rcuos/0
1 0 10 2 19 0 0 0 rcu_nocb_kthread S ? 00:00:00 \_ rcuob/0
1 0 11 2 139 - 0 0 smpboot_thread_fn S ? 00:00:04 \_ migration/0
!Current Configuration:
!
!System Description "EdgeSwitch 24-Port Lite, 1.3.0.4831995, Linux 3.6.5-f4a26ed5"
!System Software Version "1.3.0.4831995"
!System Up Time "0 days 9 hrs 54 mins 37 secs"
!Additional Packages QOS,IPv6 Management,Routing
!Current SNTP Synchronized Time: SNTP Last Attempt Status Is Not Successful
!
network protocol none
network parms 172.16.4.25 255.255.254.0 172.16.4.1
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include "lcd.h"
// Shift register pin info
#define SRCLK_PIN 2
#define DATA_PIN 1
#define RCLK_PIN 0
@MatthaeusHarris
MatthaeusHarris / fizzbuzz_no_conditional.c
Created September 1, 2017 22:39
Fizzbuzz no conditionals
#include <stdio.h>
char *fizz[3] = {"Fizz", "", ""};
char *buzz[5] = {"Buzz", "", "", "", ""};
void main(void) {
for (int i = 1; i <= 100; i++)
printf("%d\r%s%s\n", i, fizz[i%3], buzz[i%5]);
}