Skip to content

Instantly share code, notes, and snippets.

View sjmf's full-sized avatar
🏠
Working from home

Samantha Finnigan sjmf

🏠
Working from home
View GitHub Profile
Last login: Sat Feb 7 01:07:42 2015 from localhost
cpi:~$ git clone --recursive https://github.com/jupyter/colaboratory && cd colaboratory && pip install -r requirements.txt && python -m colaboratory
Cloning into 'colaboratory'...
remote: Counting objects: 1876, done.
remote: Total 1876 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (1876/1876), 1017.86 KiB | 637 KiB/s, done.
Resolving deltas: 100% (1171/1171), done.
Submodule 'colaboratory/resources/closure-library' (git://github.com/google/closure-library.git) registered for path 'colaboratory/resources/closure-library'
Submodule 'colaboratory/resources/extern/mathjax' (git://github.com/mathjax/MathJax.git) registered for path 'colaboratory/resources/extern/mathjax'
Submodule 'colaboratory/resources/extern/polymer/paper-shadow' (git://github.com/Polymer/paper-shadow.git) registered for path 'colaboratory/resources/extern/polymer/paper-shadow'
@sjmf
sjmf / logger.py
Created October 16, 2015 13:07
Stomp logger using lock
#!/usr/bin/python
from stompy.simple import Client
from flask import Flask
app = Flask(__name__)
lock = Lock()
@app.route("/")
def route():
yield from lock
@sjmf
sjmf / gist:3a9bffbb96202086cb89
Last active October 19, 2015 16:14
RabbitMQ & stomp.py SSL problems...

Working pure python3 (v3.4.3) connection code:

import socket, ssl                                              
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)        
sock.settimeout(10)                                             
wrapped= ssl.wrap_socket(sock, ssl_version=ssl.PROTOCOL_TLSv1_1)
wrapped.connect(('localhost', 61614))
#etc
@sjmf
sjmf / Testcases
Last active October 24, 2015 14:33
Testcases for tweet stripping
def test():
assert get_msg("@ol_fridge print this please", "ol_fridge") == "print this please"
assert get_msg(".@ol_fridge print this too", "ol_fridge") == "print this too"
assert get_msg("This should be printed too @ol_fridge", "ol_fridge") == "This should be printed too"
assert get_msg("@ol_fridge @SamMFinnigan this should too", "ol_fridge") == "this should too"
assert get_msg("@SamMFinnigan @ol_fridge this should also", "ol_fridge") == "this should also"
# don't print these
assert get_msg("But @ol_fridge shouldn't", "ol_fridge") == False
assert get_msg("@SamMFinnigan don't print @ol_fridge", "ol_fridge") == False
@sjmf
sjmf / bom.md
Last active November 20, 2015 21:30
HV supply BOM
@sjmf
sjmf / Investigate.ipynb
Last active January 16, 2016 18:49
Data processing with Pandas + matplotlib (Seb)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sjmf
sjmf / openlab.har
Created December 2, 2015 19:44
HAR HTTP archive of wordpress redirect
{
"log": {
"version": "1.1",
"creator": {
"name": "Firefox",
"version": "44.0a2"
},
"browser": {
"name": "Firefox",
"version": "44.0a2"
@sjmf
sjmf / baxwget.sh
Created January 18, 2016 16:58
BuildAX wget scripts
#!/bin/bash
# Script which may be added to crontab to request data from LRS using wget,
# then convert to a csv file using the bin2csv utility.
#
# Logic uses the current time via a date call to create a file name and then
# asks for last 5 minutes of readings
#
cd ${0%/*} # cd to working dir of script
# Login variables- adjust as required
@sjmf
sjmf / setup-reconnect.sh
Created January 25, 2016 10:55
Aggressive Wifi-reconnect script
#!/bin/bash
cd "$(dirname "$0")"
# Set up 3g usb dongle ZTE WCDMA Technologies MSM MF110
if [ "$EUID" -ne 0 ]; then
echo "Please run this script as root"; exit 1;
fi
# Create script in /opt/
mkdir -p /opt/wifi/
#!/usr/bin/python
"""
This script can quickly reformat a BuildAX CSV file to unix timestamp,
excluding tx power and PIR counts
In: 2015/05/15,14:51:56,427A538D,-44,2,34,20,3225,30.74,231,0,30,30367,1
Out: 1431697916,427A538D,-44,2,34,3225,30.74,23.1,0,30367,1
"""
import re
import sys