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/python2 | |
# vim: expandtab ts=4 sw=4 | |
# Inspired by http://www.raspberrypi-spy.co.uk/2015/03/bh1750fvi-i2c-digital-light-intensity-sensor/ | |
import smbus | |
import time | |
class BH1750(): | |
""" Implement BH1750 communication. """ |
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
#!/bin/bash | |
set -e | |
if [[ "$#" -lt 1 ]]; then | |
echo "Usage: $0 <hostname or IP address>" | |
exit | |
fi | |
host="$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
#!/bin/sh | |
echo "select original_name, secret, issuer from accounts;" |\ | |
sqlite3 authenticator.sqlite |\ | |
sed -rn 's_^([^|]+)\|([^|]+)\|(.+)$_otpauth://totp/\1?secret=\2\&issuer=\3_p' |\ | |
while read line | |
do | |
ttyqr $line | |
echo $line | |
echo "" |
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 python3 | |
import datetime | |
def getholidays(year): | |
"""Return a set public holidays in CZ as (day, month) tuples.""" | |
holidays = { | |
(1, 1), #Novy rok | |
(1, 5), #Svatek prace | |
(8, 5), #Den vitezstvi |
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 -c 'import getpass,hashlib; print(hashlib.new("md4",getpass.getpass().encode("utf-16le")).hexdigest())' |
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 python3 | |
import requests | |
from ripe.atlas.sagan import DnsResult | |
meas_id = 6917800 | |
source = "https://atlas.ripe.net/api/v1/measurement-latest/{}/".format(meas_id) | |
response = requests.get(source).json() | |
out = [] |
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
#!/bin/sh /etc/rc.common | |
# Copyright (C) 2016 OpenWrt.org | |
START=99 | |
USE_PROCD=1 | |
start_service() | |
{ | |
procd_open_instance | |
procd_set_param command "/root/blinkclock.py" |
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
#!/bin/bash | |
RPZ_ZONE="rpz.cesnet.cz" | |
RPZ_SERVER="nsa.cesnet.cz" | |
OUTPUT_FILE="unbound_$RPZ_ZONE.conf" | |
function resolve_target() { | |
local domain="$1" | |
shift |
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
# Copyright (c) 2017 Ondrej Caletka <ondrej@caletka.cz> | |
# | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
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 python3 | |
import random | |
import operator | |
def generate_problem(min_op=1, max_op=9, min_res=0, max_res=10): | |
operators = [operator.add, operator.sub] | |
while True: | |
opa = random.choice(range(min_op, max_op+1)) | |
opb = random.choice(range(min_op, max_op+1)) | |
oper = random.choice(operators) |