Skip to content

Instantly share code, notes, and snippets.

View benjaminchodroff's full-sized avatar

Benjamin Evans Chodroff benjaminchodroff

View GitHub Profile
@benjaminchodroff
benjaminchodroff / poap2nfc.py
Created June 30, 2022 13:55
Turn a list of POAP claim URLs into a NXP TagWriter json-like format for iPhone NFC ntag213
import ndef
import sys
# The NXP app expects an exact format of the following, including whitespace and quotes
#[
# {
# "type" : "55",
# "mirrorparameters" : "",
# "date" : 1655959791718,
# "bytes" : "03504f41502e78797a2f636c61696d2f7075676a6173",
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@benjaminchodroff
benjaminchodroff / momentumBittrex.ipynb
Created August 24, 2017 19:47
Momentum with Bittrex
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@benjaminchodroff
benjaminchodroff / wavgrep.py
Created June 14, 2017 19:56 — forked from patrakov/wavgrep.py
Find the piece most similar to one wav file (needle) in another (haystack)
#!/usr/bin/python2
import sys
import numpy
from scipy.io import wavfile
from scipy.signal import fftconvolve
def usage():
print >> sys.stderr, "Usage: wavgrep.py --like|--similar|--this needle.wav haystack.wav"
@benjaminchodroff
benjaminchodroff / minimal-aliyun.tf
Created April 3, 2017 05:09
Minimal VPC ECS instance with Security Groups in Aliyun
# Create a new ECS instance for classic
resource "alicloud_security_group" "vpc" {
name = "tf_test_foo"
vpc_id = "${alicloud_vpc.vpc.id}"
}
resource "alicloud_security_group_rule" "allow_ssh" {
type = "ingress"
ip_protocol = "tcp"
nic_type = "intranet"
@benjaminchodroff
benjaminchodroff / qingcloudVPCCreateDestroy.txt
Last active March 28, 2017 19:48
QingCloud automated VPC bastion host creation and deletion
pip install --upgrade qingcloud-cli
# CLI documentation: https://docs.qingcloud.com/cli/index.html
# API documentation: https://docs.qingcloud.com/api/index.html
# CLI Source: https://github.com/yunify/qingcloud-cli
# Python SDK Source: https://github.com/yunify/qingcloud-sdk-python
#Provision SubAccount in master account manual - log in, create an access key, and install the python CLI for qingcloud with your key, secret, and zone set in ~/.qingcloud/config.yaml
#Create security group
securitygroup=$( qingcloud iaas create-security-group --security_group_name "securitygroup-0000" | python -c 'import json,sys;print(json.load(sys.stdin)["security_group_id"]);' )
#Add security group rules (Ping and SSH)

Keybase proof

I hereby claim:

  • I am benjaminchodroff on github.
  • I am benjaminchodroff (https://keybase.io/benjaminchodroff) on keybase.
  • I have a public key whose fingerprint is 7D04 501A 9446 11CD 602E 6F55 790B FC19 96BC 3A53

To claim this, I am signing this object:

@benjaminchodroff
benjaminchodroff / oandamomentumv20.ipynb
Created March 7, 2017 03:05
OANDA v20 API with Time Series Momentum Strategy
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import rpy2.robjects.lib.ggplot2 as ggplot2
import rpy2.robjects as ro
from rpy2.robjects.packages import importr
from rpy2.robjects import pandas2ri
pandas2ri.activate()
predprice = pd.DataFrame({"Predicted": [x for x in pred], "Actual": [y for y in price], "Color": [z for z in color], "Clarity": [x for x in clarity]})
yourdiamond = pd.DataFrame({"Predicted": [ypred],"Actual": [ypri]})
ro.globalenv['dataframe'] = predprice
pp = ggplot2.ggplot(predprice)
@benjaminchodroff
benjaminchodroff / alarmdetect.py
Created February 18, 2017 06:35
raspberry pi microphone alarm detection
#!/usr/bin/env python
import pyaudio
from numpy import zeros,linspace,short,fromstring,hstack,transpose,log
from scipy import fft
from time import sleep
#Volume Sensitivity, 0.05: Extremely Sensitive, may give false alarms
# 0.1: Probably Ideal volume
# 1: Poorly sensitive, will only go off for relatively loud
SENSITIVITY= 1.0