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 / 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 == "":
View gist:8198a1311f4e8fa3b8376e93d24cafb1
public void handleRequest(ScrapeReq input) throws Exception {
FlowFuture<ScrapeResp> scrapes = currentFlow().invokeFunction("./scraper", input, ScrapeResp.class);
scrapes.thenCompose(resp -> {
List<ScrapeResp.ScrapeResult> results = resp.result;
List<FlowFuture<?>> pendingTasks = results
.stream()
@mjg123
mjg123 / flags.diff
Created Jan 16, 2018
JDK10 Ergonomics in container.
View flags.diff
--- host.flags 2018-01-16 13:09:27.257621324 +0000
+++ container.flags 2018-01-16 13:12:20.832503747 +0000
@@ -56,7 +56,7 @@
bool C1ProfileInlinedCalls = true {C1 product} {default}
bool C1ProfileVirtualCalls = true {C1 product} {default}
bool C1UpdateMethodData = true {C1 product} {default}
- intx CICompilerCount = 18 {product} {ergonomic}
+ intx CICompilerCount = 15 {product} {ergonomic}
bool CICompilerCountPerCPU = true {product} {default}
bool CITime = false {product} {default}
View Dockerfile-jdk10
FROM debian:sid-slim
ADD jdk-10-ea+39_linux-x64_bin.tar.gz /java
ENTRYPOINT ["/java/jdk-10/bin/jshell", "-q"]
You can’t perform that action at this time.