Skip to content

Instantly share code, notes, and snippets.

View hammertoe's full-sized avatar

Matt Hamilton hammertoe

View GitHub Profile

Using a docker image for a cloud function

% ic fn action create calculate_alignment calculate_alignment.py --docker hammertoe/librosa_ml:latest

Invoking the function

% ic fn action invoke calculate_alignment -p referece leader.wav -p part sarah.wav
import json
import os
import requests
import librosa
import io
import numpy as np
SAMPLE_RATE = 44100
# function to measure two waveforms with one offset by a certian amount
require('dotenv').config();
var express = require('express');
var passport = require('passport');
var Strategy = require('passport-twitter').Strategy;
var Twit = require('twit');
var axios = require('axios');
// Tone analyser creds
tone_url = process.env['TONE_URL'],
app.get('/tweets',
require('connect-ensure-login').ensureLoggedIn(),
function(req, res) {
var T = new Twit({
consumer_key: process.env['TWITTER_CONSUMER_KEY'],
consumer_secret: process.env['TWITTER_CONSUMER_SECRET'],
access_token: req.user.token,
access_token_secret: req.user.tokenSecret,
timeout_ms: 60*1000, // optional HTTP request timeout to apply to all requests.
app.get('/tweets',
require('connect-ensure-login').ensureLoggedIn(),
function(req, res) {
// Create client instance to connect to Twitter
// We pass in the access token we got from the OAuth process
var T = new Twit({
consumer_key: process.env['TWITTER_CONSUMER_KEY'],
consumer_secret: process.env['TWITTER_CONSUMER_SECRET'],
access_token: req.user.token,
<VirtualHost [2001:41c8:11a:5::1]:443 46.43.0.47:443>
ServerName www.quernus.co.uk
ServerAlias quernus.co.uk
DocumentRoot "/var/www/htdocs/www.quernus.co.uk/"
Header always set Strict-Transport-Security "max-age=63072000; preload"
SSLEngine on
SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH
SSLProtocol All -SSLv2 -SSLv3
{
"addresses": [
{
"paymentNetwork": "XRPL",
"environment": "MAINNET",
"addressDetailsType": "CryptoAddressDetails",
"addressDetails": {
"address": "X75nEw5QD8Ej8jWt7EkJXHoVAV9YCtjuUSJppADpNtPKdim"
}
}
@hammertoe
hammertoe / send_payment.py
Last active July 2, 2020 20:13
Send a payment with XRP
import xpring
import time
seed = 'snzBUmvTTAzCCRwGvGfKeA6Zqn4Yf'
wallet = xpring.Wallet.from_seed(seed) # create wallet from seed
dest = "rszDsdn8bUH9KRxM7DgvJS6oJ1w7kjQBfi" # where we want to send to
amount = 1000 # amount in drops to send
url = 'test.xrp.xpring.io:50051'
FROM openwhisk/action-golang-v1.12
RUN <command to install deps for go>
@hammertoe
hammertoe / chat.html
Created August 5, 2020 08:50
IBM stream chat overlay
<html>
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans&display=swap" rel="stylesheet">
<style type="text/css">
ul { list-style: none; padding: 0; }
body { background-color: black; font-family: 'IBM Plex Sans'; }
a { color: white; }
.who { color: #bb8eff; float: left; }
.who::after { content: ":" }
.what { color: white; margin-left: 0.5em; }
.container {