Skip to content

Instantly share code, notes, and snippets.

Matthew Gilliard mjg123

Block or report user

Report or block mjg123

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mjg123
mjg123 / Demos.java
Created Jul 25, 2019
Java code demonstrating how to generate HOTP and TOTP codes. Used in my talk 2FA 2Furious
View Demos.java
package lol.gilliard;
import com.amdelamar.jotp.OTP;
import com.amdelamar.jotp.type.Type;
import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
// This code uses Austin Delamar's JOTP: https://github.com/amdelamar/jotp
View TwilioRaffle.java
package prizedraw;
import com.twilio.Twilio;
import com.twilio.base.ResourceSet;
import com.twilio.rest.api.v2010.account.Message;
import com.twilio.type.PhoneNumber;
import org.joda.time.DateTime;
import java.util.Collections;
import java.util.stream.Collectors;
View GolExample.java
public class GolExample {
public static void main(String[] args) {
int [][] generation = {
{0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0},
View MakeACall.java
// 1. Sign up -> twilio.com/try-twilio
// 2. Get a number -> twilio.com/console
// 3. Add the Twilio Java library
// --> twilio.com/docs/libraries/java
import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.Call;
import com.twilio.type.PhoneNumber;
import java.net.URI;
@mjg123
mjg123 / SendSms.java
Created May 2, 2019
CodeCard Java SMS
View SendSms.java
// 1. Sign up -> twilio.com/try-twilio
// 2. Get a number -> twilio.com/console
// 3. Add the Twilio Java library
// --> twilio.com/docs/libraries/java
import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.Message;
import com.twilio.type.PhoneNumber;
class SendSms {
@mjg123
mjg123 / worker-queue.clj
Created Oct 21, 2011
Worker Queues in Clojure
View worker-queue.clj
(defn new-q [] (java.util.concurrent.LinkedBlockingDeque.))
(defn offer!
"adds x to the back of queue q"
[q x] (.offer q x) q)
(defn take!
"takes from the front of queue q. if q is empty, block until something is offer!ed into it"
[q] (.take q))
@mjg123
mjg123 / Convert.java
Last active May 9, 2018
A little class for re-writing Java method names when using `jaotc`
View Convert.java
public class Convert {
public static void main(String args[]) throws Throwable {
int i;
boolean inParams = false;
while ((i = System.in.read()) >= 0) {
switch (i) {
case ':':
continue; // skip
case '/':
if (!inParams) {
@mjg123
mjg123 / latinsq.clj
Created Oct 26, 2011
Latin square solver in clojure
View latinsq.clj
(ns latinsq.core
(:use [clojure.set :only (difference)]))
(defn replace-at
"in string s, replaces character at index p with c"
[s p c]
(str
(.substring s 0 p)
c
@mjg123
mjg123 / func.py
Last active Apr 10, 2018
Example fn code to query the OsloBysykkel API
View func.py
import json
import urllib2
import sys
try:
input = json.loads(''.join(sys.stdin.readlines()))['body']
except:
input=""
if input == "":
You can’t perform that action at this time.