Skip to content

Instantly share code, notes, and snippets.

View imrehg's full-sized avatar
🐒
Chaos Monkey

Gergely Imreh imrehg

🐒
Chaos Monkey
View GitHub Profile
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCa2kIKfTdOWTX99jUNw0gGHEBguyJE5F6NDfLpsjCLvQn0WZ9TEUS+WQy9a348yg3LwAAwtevu6pSTPpiWDUtaA/xjcDD/mxzCVRsqkJoM48RrFW594qI5c8Z/GsQJTXq7NI+ViyjznIETPtVk9bXCMikGyQ1yD/RnbBMBlRlraQFrltu1vzWe7Bm+6VSFBcb82MmuqomppOkZmH9N+7K1FSh+WJz+nB0c0nivTbsCHtIKiRq/ttu06odhr/DY0d6RXxJLP54azKRah9AjqH/6vVFJaRF7Pai4C5+9NtOYhU7/xLhpORUsgqtW1yzbKHCreI5XvzbWlRRJEtmubprb greg@nostromo
@imrehg
imrehg / handover.py
Last active July 14, 2016 06:16
Example of a script being able to hand-over to a second instance of itself
"""
Python `hand-over` strategy example
"""
import os
import sys
import socket
SOCKFILE = "/tmp/handover.sock"
# Check for this script already running
@imrehg
imrehg / dangerous_erase.sh
Created June 3, 2016 09:40
Disk eraser script
#!/bin/bash
# From http://unix.stackexchange.com/questions/72216/fast-way-to-randomize-hd
DISK="/dev/sda"
SIZE=`fdisk -l | grep "${DISK}" | awk '{print $5}'`
echo "Erasing ${DISK} (size ${SIZE} bytes)"
read -p "Are you sure? " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
@imrehg
imrehg / autotest.js
Created May 27, 2016 12:39
Telemetry
AUTOBAHN_DEBUG = true;
var https = require('https');
https.globalAgent.options.rejectUnauthorized = false;
var autobahn = require('autobahn');
var connection = new autobahn.Connection({
url: 'wss://ingest.epeakgears.com:1337/ws'
, realm: 'xyala'
});
@imrehg
imrehg / example.ino
Created May 14, 2016 08:34
OCTeleShield telemetry example
#include <SPI.h>
#include <Adafruit_MAX31855.h>
// Example creating a thermocouple instance with hardware SPI (Uno/Mega only)
// on a given CS pin.
#define CS1 2
#define CS2 3
Adafruit_MAX31855 th1(CS1);
Adafruit_MAX31855 th2(CS2);
@imrehg
imrehg / leisure.py
Created February 25, 2016 08:23
Leisure vs Money plotting
#!/usr/bin/env python
"""
Leasure vs Money
Inspiration
Tweet by Stanford Econ Policy https://twitter.com/SIEPR/status/702637668883152896
Data sources
* GDP per capita PPP: : World Bank http://data.worldbank.org/indicator/NY.GDP.PCAP.PP.CD?display=default
* GDP per capita current USD: World Bank http://data.worldbank.org/indicator/NY.GDP.PCAP.CD/countries?display=default
* Working hours: OECD.stat https://stats.oecd.org/Index.aspx?DataSetCode=ANHRS
@imrehg
imrehg / PKGBUILD
Created November 26, 2015 08:46
pps-tools package for ArchLinux
# Maintainer: Gergely Imreh <imrehg@gmail.com>
pkgname=pps-tools-git
pkgver=r17.0deb9c7
pkgrel=1
pkgdesc="User-space tools for LinuxPPS and kernel header"
arch=('armv7h')
url="https://github.com/ago/pps-tools"
license=('GPL2')
groups=()
depends=()
@imrehg
imrehg / telemetry-receive.js
Last active November 11, 2015 09:57
Telemetry with Arduino Yun
var autobahn = require('autobahn');
var connection = new autobahn.Connection({
url: 'ws://octv-versus.ddns.net:8080/ws',
realm: 'octv1'}
);
connection.onopen = function (session) {
// SUBSCRIBE to a topic and receive events
@imrehg
imrehg / test.log
Created November 3, 2015 06:31
gandi.cli build test with Python 3.5
running test
Searching for httpretty==0.8.6
Reading https://pypi.python.org/simple/httpretty/
Best match: httpretty 0.8.6
Downloading https://pypi.python.org/packages/source/h/httpretty/httpretty-0.8.6.tar.gz#md5=d45e7e831b6e66974ba231453a715f39
Processing httpretty-0.8.6.tar.gz
Writing /tmp/easy_install-e9dz1nez/httpretty-0.8.6/setup.cfg
Running httpretty-0.8.6/setup.py -q bdist_egg --dist-dir /tmp/easy_install-e9dz1nez/httpretty-0.8.6/egg-dist-tmp-ks58_gv1
creating /home/greg/prog/gandi.cli/.eggs/httpretty-0.8.6-py3.5.egg
Extracting httpretty-0.8.6-py3.5.egg to /home/greg/prog/gandi.cli/.eggs
@imrehg
imrehg / pcieduino_test.py
Last active September 25, 2015 08:09
PCIeDuino test script 01
#!/usr/bin/env python2
"""
Script to test the PCIeDuino serial connection
"""
import serial
import time
import datetime
for i in range(10):
try: