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 http.server | |
import socketserver | |
import socket | |
class TCP6Server(socketserver.TCPServer): | |
address_family = socket.AF_INET6 | |
def server_bind(self): | |
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 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
#!/usr/bin/env python3 | |
import email | |
from email.mime.multipart import MIMEMultipart | |
import sys | |
from subprocess import Popen, PIPE | |
def reformat(msg): | |
"""Reformat the MIME parts of the message to a sane one.""" | |
newmsg = MIMEMultipart() |
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 | |
# vim: ts=4 expandtab | |
import sys | |
class Peg: | |
""" Stack representing one Hanoi peg. """ | |
def __init__(self, n=0): | |
self.stack = [] | |
self.stack.extend(range(1,n+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
#!/usr/bin/env python3 | |
import requests | |
import hashlib | |
import base64 | |
log_list = "https://www.gstatic.com/ct/log_list/all_logs_list.json" | |
logs = requests.get(log_list).json() | |
for log in logs['logs']: |
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 | |
import json | |
log_list = "https://www.gstatic.com/ct/log_list/log_list.json" | |
logs = requests.get(log_list).json() | |
outlogs = [] | |
for log in logs["logs"]: |
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 python2 | |
import pygtk | |
pygtk.require('2.0') | |
import gtk | |
import glib | |
import cairo | |
import math | |
import datetime | |
# Create a GTK+ widget on which we will draw using Cairo |
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 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
#!/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) |
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 | |
SCREEN_SIZE="1920x1080" | |
ORIGIN="0,0" | |
# For dual screen setup where projected is on the right side of the desktop: | |
#ORIGIN="1920,0" | |
ffmpeg -vaapi_device /dev/dri/renderD128 -framerate 25 -video_size $SCREEN_SIZE \ | |
-f x11grab -i :0+$ORIGIN -f pulse -ac 2 -i default -vf 'format=nv12,hwupload' \ | |
-c:v h264_vaapi -c:a aac screencast-$(date +%H%M%S).mkv |