Skip to content

Instantly share code, notes, and snippets.

View sagnew's full-sized avatar

Sam Agnew sagnew

  • Twilio
  • New York City
View GitHub Profile
@sagnew
sagnew / README.md
Last active August 30, 2024 05:37
DTMFighter

You will need to install and set up a SNES9X emulator that has Lua scripting functionality. This typically is labeled "rerecording" or something similar, and is usually the Windows version. If you are running Mac or Linux like I am, you will also need to install Wine. You will also need a ROM of Street Fighter II, or any other game of your choice.

I would link to the SNES emulator and the ROM directly, but that's technically illegal unless you own the console and games themselves in real life (I do). DM me for help if you can't find them elsewhere.

The code above are for the Flask app you'll need to run for the Twilio portion, and the Lua script you will have to run in the emulator.

@sagnew
sagnew / node5md.js
Last active August 2, 2018 19:53
Twilio Node API Demo
// The Twilio Node library checks the environment variables
// 'TWILIO_ACCOUNT_SID' and 'TWILIO_AUTH_TOKEN' by default when instantiating a client object.
const client = require('twilio')();
const numbers = new Set()
client.messages.each({
to: '+12019497446',
}, (message) => {
if (!numbers.has(message.from)) {
numbers.add(message.from);
@sagnew
sagnew / pokemon.lua
Last active April 24, 2018 23:01
pokemon
function read_file(name)
local input = io.open(name, 'r')
if input ~= nil then
io.input(input)
content = io.read()
io.close(input)
return content
end
@sagnew
sagnew / flags.swift
Last active May 23, 2017 22:56
Debugging code challenges for ShipIt! at $BASH
enum VNodeFlag: UInt32 {
case Delete = 0x00000001
case Write = 0x00000002
case Extended = 0x00000004
case Attrib = 0x00000008
case Link = 0x00000010
case Rename = 0x00000020
case None = 0x00000080
}
@sagnew
sagnew / app.py
Created May 23, 2017 20:58
Python debugging code challenge
import re
from flask import Flask, request
from twilio import twiml
app = Flask(__name__)
@app.route('/sms', methods=['POST']): # This decorator has no function. There should be a function def on the next line.
@sagnew
sagnew / bash.bas
Last active August 30, 2017 08:16
$BASH 2017 Apple IIe BASIC game
10 REM Clear the screen
20 TEXT : HOME
25 REM DISPLAY WELCOME SCREEN
30 VTAB 4: HTAB 15: PRINT "$BASH RACER"
40 VTAB 13: HTAB 3: PRINT "USE LEFT AND RIGHT ARROW KEYS TO MOVE"
50 VTAB 14: HTAB 7: PRINT "ANY OTHER KEY GOES STRAIGHT"
60 VTAB 21: PRINT "PRESS ANY KEY TO PLAY"
65 VTAB 23: PRINT "SCORE 5000 POINTS TO WIN"
70 REM WAIT FOR KEYPRESS
80 GET KEY$
@sagnew
sagnew / app.py
Created August 17, 2016 19:29
Receive an SMS in Python video
from flask import Flask, request
from twilio import twiml
app = Flask(__name__)
@app.route('/sms', methods=['POST'])
def sms():
number = request.form['From']
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Yay Video</title>
</head>
<body>
<div id="eddie"></div>
<div id="sam"></div>
<script src="https://media.twiliocdn.com/sdk/js/common/v0.1/twilio-common.min.js"></script>
@sagnew
sagnew / chat.js
Last active November 25, 2015 04:12
// We will be using jQuery to manipulate DOM elements for the chat.
var $ = require('jquery');
// Manages the state of our access token we got from the server
var accessManager;
// Our interface to the IP Messaging service
var messagingClient;
// The object we are going to export as this module
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No license field.
|
> [email protected] install /Users/sagnew/Test/IPM/gameboy/node_modules/canvas
> node-gyp rebuild
SOLINK_MODULE(target) Release/canvas-postbuild.node
ld: library not found for -lgcc_s.10.5
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Release/canvas-postbuild.node] Error 1