Skip to content

Instantly share code, notes, and snippets.

View tompreston's full-sized avatar

Tom Preston tompreston

  • Monzo
  • Manchester
View GitHub Profile
args <- commandArgs(TRUE)
# out/gl002/20180329-080444/logsysstat-glmark2.dat
logfile <- args[1]
print(paste("log file is", logfile))
log <- read.table(logfile, header=FALSE)
colnames(log) <- c("timestamp", "counter", "counter2")
# add differential (+1 empty row at start)
#!/bin/bash
# Enable IP Forwarding
# Run this, then route packets on device with:
#
# ip route add default via THIS_DEVICE_IP
#
OUT_IFACE=enp0s25
IN_IFACE=enx00249b1ad5b2
IPTABLES=/sbin/iptables
import paramiko
if __name__ == '__main__':
ssh = paramiko.SSHClient()
# important line if you've never logged into the machine before
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('192.168.0.10', username='pi', password='raspberry')
ssh.exec_command('touch /tmp/sshisawesome')
@tompreston
tompreston / twitter-media-upload.py
Last active March 6, 2019 01:27
Upload media with Python Twitter Tools
#!/usr/bin/env python3
from twitter import Twitter, OAuth
from twitter_auth import (CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN,
ACCESS_TOKEN_SECRET)
if __name__ == '__main__':
my_auth = OAuth(token=ACCESS_TOKEN,
token_secret=ACCESS_TOKEN_SECRET,
consumer_key=CONSUMER_KEY,