Skip to content

Instantly share code, notes, and snippets.

Matthew Gilliard mjg123

View GitHub Profile
@mjg123
mjg123 / IncomingCallWebhook.java
Created Mar 25, 2020
Spring Web controller that produces TwiML for creating a conference call
View IncomingCallWebhook.java
package lol.gilliard.conferencecalls;
import com.twilio.twiml.VoiceResponse;
import com.twilio.twiml.voice.Conference;
import com.twilio.twiml.voice.Dial;
import com.twilio.twiml.voice.Say;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@mjg123
mjg123 / doomsday_flow.json
Created Feb 27, 2020
Twilio Studio Flows for conversations SMS bots to practise the Doomsday algorithm
View doomsday_flow.json
{
"description": "Doomsday by SMS",
"states": [
{
"name": "Trigger",
"type": "InitialState",
"properties": {
"offset": {
"x": 0,
"y": 0
@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}
You can’t perform that action at this time.