Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import pymongo, mosquitto, os
from pymongo import MongoClient
from datetime import datetime, time
mqttHost = 'mqtt'
mongoHost = '127.0.0.1'
pidFile = '/var/run/record2MongodbPid'
def isRunning(pid):
try:
@koma5
koma5 / publishMongoStats.py
Created January 10, 2017 10:55
publish statistics about a mongodb which is recording every mqtt message in my network
import os, pymongo, mosquitto, json
from pymongo import MongoClient
client = MongoClient('mongo')
records = client.mqttRecord
mqttC = mosquitto.Mosquitto("publishMongoStats-"+str(os.getpid()))
mqttC.connect("mqtt", 1883, 60)
@koma5
koma5 / gist:f1a485a0aa45fea990a3fb46a865002b
Created January 7, 2017 16:08
keep your Browser busy forever by opening data url.
data:text/html,<script>for(;0<1;){}</script>
# obscured with base64
data:text/html;charset=utf-8;base64,PHNjcmlwdD5mb3IoOzA8MTspIHt9PC9zY3JpcHQ+Cg==
# make sure user.name and user.email are set correctly this time
# check with
git log --format=fuller
# fix author
git rebase -i --root -x "git commit --amend --author 'John Doe <john.doe@example.org>' -CHEAD"
# fix date of commit to date of authoring
git filter-branch --env-filter '
@koma5
koma5 / magnetHashHexPic.py
Created December 13, 2016 18:51
create a grayscale picture of magnet links
#!/usr/bin/python
import Image, sys, random
hash = random.choice(['411A7A164505636AB1A8276395B375A3A30BFF32',
'79816060EA56D56F2A2148CD45705511079F9BCA',
'f5615dfb80ac995787c1b2219a75df7805278dea',
'43b21801f59336b9271a6c5113904fb72de99ed3',
'938802790a385c49307f34cca4c30f80b03df59c'])
if(len(sys.argv) == 4):