Skip to content

Instantly share code, notes, and snippets.

View mjohnson9's full-sized avatar

Mike Johnson mjohnson9

View GitHub Profile
import Shortcuts 1092.8.7
#Color: Red, #Icon: shortcuts
// TODO: Add a check to see if at work and only use reminders from work if that's the case
filterReminders(input: All Reminders, filterType: All, filter: {Is Not Completed}, sortBy: End Date, order: Latest First) ->[Base Reminder List]
// Check for reminders due before now
filterReminders(input: Base Reminder List, filter: {Due Date: .before: Current Date}) ->[Past Reminder List]
// First, check for high priority reminders
#!/bin/bash
if [ ! -d /etc/letsencrypt/live ]; then
echo "No letsencrypt directory found"
exit 1
fi
function issueCert {
/root/.local/share/letsencrypt/bin/letsencrypt certonly $1
return $?
}
package main
import (
cryptorand "crypto/rand"
"fmt"
"image"
"image/color"
"image/png"
"math/big"
"math/rand"
@mjohnson9
mjohnson9 / syslog-to-journal.go
Last active October 25, 2015 15:49
A trivial syslog-to-journal implementation
package main
import (
"fmt"
"io"
"net/http"
"time"
"github.com/jeromer/syslogparser"
local ffi = require("ffi")
local pcre = ffi.load("pcre")
ffi.cdef([[
typedef struct real_pcre pcre;
typedef struct pcre_extra pcre_extra;
typedef const char * PCRE_SPTR;
static const int PCRE_STUDY_JIT_COMPILE = 0x0001;
#!/bin/bash
(echo "Program Source Destination"; (netstat -lantp | grep ESTABLISHED | awk '{print $7" "$4" "$5}' | sort -u)) | column -t
@mjohnson9
mjohnson9 / linter.coffee
Created October 10, 2015 17:18
Systems United Navy: Roster Linter
###
Roster Linter
Created by Michael "NightExcessive" Johnson
Released under the MIT License
###
PublicCache = CacheService.getPublicCache()
class StringUtil
@isAlphanumeric: (char) ->
@mjohnson9
mjohnson9 / client.js
Last active August 29, 2015 14:23
Speed test
var timerFunc;
if(window.performance) {
timerFunc = performance.now.bind(performance);
} else {
timerFunc = Date.now.bind(Date);
}
if(window.xhr) { xhr.abort(); }
xhr = new XMLHttpRequest();
xhr.responseType = "blob";
<link rel="import" href="../smoothie-chart/smoothie-chart.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
@mjohnson9
mjohnson9 / dscp-designer.go
Last active March 1, 2016 04:35
QoS designer for RouterOS devices
package main
import (
"bytes"
"flag"
"fmt"
"io"
"os"
"strconv"
"strings"