This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys, json | |
from gi.repository import Notify | |
sys.path.append("paho-mqtt-1.2/src/") | |
import paho.mqtt.client as mqtt | |
def _on_connect(client, userdata, rc): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from subprocess import Popen, PIPE | |
import urllib2 | |
from time import sleep | |
p = Popen(['/sbin/apcaccess'], stdout=PIPE, stderr=PIPE) | |
(o, e) = p.communicate() | |
status = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# | |
# DLink DIR-615 HW:T1 FW:20.07 status. | |
from sys import argv, exit | |
import urllib as u1 | |
import urllib2 as u2 | |
import bs4 | |
# Router IP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import random, sys | |
def distribute(parts, value): | |
total = sum(parts) | |
min_value = len(parts) | |
if ((value < min_value) or (value > total)): | |
return None | |
cur = [1]*len(parts) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys, time | |
id = 1234567890 | |
lfsr = 0xDEADBEEF | |
def lfsrN(lfsr, count): | |
#0b10101010101 | |
#0x80000417, 0b10000000 00000000 0000 0100 0001 0111 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!python | |
import RPi.GPIO as GPIO | |
import time | |
import sys | |
GPIO.setmode(GPIO.BOARD) | |
bint = 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hashlib, hmac, base64, struct, time, math | |
def GoogleTOTP(s): | |
msg = int(math.floor(time.time()/30)) | |
hm = hmac.new(base64.b32decode(s), struct.pack('>q', msg), hashlib.sha1).digest() | |
offs = ord(hm[-1]) & 0xF | |
code = str(((struct.unpack('>L',hm[offs:offs+4])[0]) & 0x7FFFFFFF) % 1000000).zfill(6) | |
return code | |
print GoogleTOTP("") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set-option -g status on | |
set -g terminal-overrides 'xterm*:smcup@:rmcup@,rxvt*:smcup@:rmcup@' | |
# Emacs add prefix as well, keep telnet escape as prefix. | |
unbind-key C-b | |
set-option -g prefix C-] | |
set-option -g prefix2 C-x | |
# Emacs window management keys | |
unbind-key -T prefix 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// mc_cat <mc group> <port> [<from addr>] | consumer | |
// | |
use std::env; | |
use std::net::{UdpSocket, SocketAddrV4, IpAddr, Ipv4Addr}; | |
use std::str::FromStr; | |
use std::error::Error; | |
use std::io::Write; | |
macro_rules! eprintln(($($arg:tt)*) => { writeln!(&mut std::io::stderr(), $($arg)*).expect("Fail at failing."); } ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# | |
# List Quantum migrated and non-migrated (ESR) firefox profiles. | |
# Assumes the preference 'extensions.lastAppVersion' kinda tells firefox version last used with a profile. | |
# Use at your own risk. | |
# | |
import os, sys, re | |
ff_path=os.environ['HOME']+'/.mozilla/firefox/' |