Skip to content

Instantly share code, notes, and snippets.

@sammachin
sammachin / install.sh
Created April 30, 2018 13:25
Node building blocks webhook prereqs
npm install express
npm install body-parser
@sammachin
sammachin / install.sh
Created April 30, 2018 12:19
Python Nexmo Client pre-reqs
pip install nexmo
@sammachin
sammachin / install.sh
Created April 30, 2018 10:54
python webhook pre-requisites
pip install ‘flask>=1.0’
var handlers = {
'LaunchRequest': function () {
this.emit('SayHello');
},
'SayHello': function(){
if (this.event.user.hasOwnProperty('accessToken')) {
this.response.speak('Hello User');
this.emit(':responseReady');
}
else {
var handlers = {
'LaunchRequest': function () {
this.emit('SayHello');
},
'SayHello': function(){
if (this.event.user.hasOwnProperty('accessToken')) {
this.response.speak('Hello User');
this.emit(':responseReady');
}
else {
@sammachin
sammachin / downsample.js
Created December 1, 2017 09:57
Node Downsample 16Khz > 8Khz
// Downsample frames from 16Khz to 8Khz
function convert(message){
var arr = []
var x = 0;
var y;
var i;
for (i = 0; i < 160; i++) {
y = x+2
arr.push(message.slice(x,y))
x += 4;
@sammachin
sammachin / gist:65280ae9eedcbdff83795b5bb5e9f51f
Created October 16, 2017 12:04
raw.githubusercontent.com SSL Cert
Sams-iMac:~ smachin$ openssl s_client -connect raw.githubusercontent.com:443
CONNECTED(00000003)
depth=1 /C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert SHA2 High Assurance Server CA
verify error:num=20:unable to get local issuer certificate
verify return:0
---
Certificate chain
0 s:/C=US/ST=California/L=San Francisco/O=GitHub, Inc./CN=www.github.com
i:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert SHA2 High Assurance Server CA
1 s:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert SHA2 High Assurance Server CA
@sammachin
sammachin / gist:8298386
Created January 7, 2014 12:07
Hack the CES Scavenger hunt ;-) You'll need a recent mac with BT4.0 running mavericks, and a copy of bleacon (npm install bleacon) start the scavenger hunt, then run this script and sit back.
#! /usr/bin/env node
var Bleacon = require('bleacon');
var uuid = '842AF9C408F511E39282F23C91AEC05E';
var major = 65000;
var measuredPower = -59;
function myLoop(){
setTimeout(function () {
Bleacon.stopAdvertising();
@sammachin
sammachin / gist:35f4598b54b73f51e079
Created January 29, 2016 13:05
CallerID By Google Request
GET /plus/v2whitelisted/people/lookup?includePeople=1&includeGal=1&type=phone&fields=kind,items(id,metadata(objectType,plusPageType,attributions),names,phoneNumbers(value,type,formattedType,canonicalizedForm),addresses(value,type,formattedType),images(url,metadata(container)),urls(value),placeDetails)&includePlaces=1&callType=outgoing&id=%2B441934834343 HTTP/1.1
Authorization: Bearer xxxxxxxxxREDACTEDxxxxxxxxxxxxx
User-Agent: Dalvik/2.1.0 (Linux; U; Android 6.0.1; Nexus 6 Build/MMB29S)
Host: www.googleapis.com
Connection: Keep-Alive
Accept-Encoding: gzip
HTTP/1.1 200 OK
Expires: Fri, 29 Jan 2016 12:47:28 GMT
@sammachin
sammachin / db2s3.py
Created January 27, 2016 10:45
Dropbox to S3 image upload
import dropbox
import tinys3
import tempfile
from string import Template
import random
import string
S3_ACCESS_KEY = ""
S3_SECRET_KEY= ""