Skip to content

Instantly share code, notes, and snippets.

View joneskoo's full-sized avatar

Joonas Kuorilehto joneskoo

View GitHub Profile
@joneskoo
joneskoo / gist-backup.py
Created December 15, 2011 06:13
Clone all my gists automatically (gist backup?)
#!/usr/bin/env python
# Git clone all my gists
import json
import urllib
from subprocess import call
from urllib import urlopen
import os
USER = os.environ['USER']
@joneskoo
joneskoo / sennheiser_hd595.scpt
Created January 27, 2024 11:43
Sennheiser HD595 AutoEQ settings for Apple Music
// https://autoeq.app
// Sennheiser HD595 / iTunes Built-in equalizer
tell application "Music"
activate
set newPreset to make new EQ preset
set name of newPreset to "Sennheiser HD595"
set band 1 of newPreset to 12
set band 2 of newPreset to 4.8
set band 3 of newPreset to -0.1
set band 4 of newPreset to -2.5
@joneskoo
joneskoo / new_peer.sh
Created June 6, 2019 19:12
Wireguard client/server config generator
#!/bin/bash
set -eu
set -o pipefail
dns_server=172.24.100.250
client_ip=$1
psk=$(wg genpsk)
client_privkey=$(wg genkey)
client_pubkey=$(wg pubkey <<<"$client_privkey")
@joneskoo
joneskoo / table_to_sqlite3.py
Last active May 12, 2023 03:20
Parse HTML table to CSV
#!/usr/bin/env python3.4
import sys
import sqlite3
from html.parser import HTMLParser
class TableParser(HTMLParser):
def __init__(self):
@joneskoo
joneskoo / ssh-knownhosts-cleanup.py
Last active April 3, 2023 00:42
SSH known hosts cleanup script. Combines same fingerprints to one line.
#!/usr/bin/env python3
# encoding: utf-8
# By Joonas Kuorilehto 2011, MIT license
#
# The script combines .ssh/known_hosts so that each fingerprint is only
# listed once.
import re
import sys
import os
@joneskoo
joneskoo / sms-mailer.py
Last active December 31, 2022 14:33
Send unread SMS messages (from adb shell) to email
#!/usr/bin/env python3
# Joonas Kuorilehto 2013
# This script is Public Domain.
import csv
import subprocess
import pipes
from datetime import datetime
import smtplib
@joneskoo
joneskoo / .htaccess
Last active October 25, 2020 06:41
Kapsi Django example project
Options -Indexes
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ http://lakka.n.kapsi.fi:31859/$1 [L,P]
@joneskoo
joneskoo / interfaces.d-wan0
Last active May 16, 2020 15:06
interfaces.d for CAKE traffic shaping on cable modem (1G/100M)
auto wan0
iface wan0 inet dhcp
bridge_ports enp9s0 enp4s0f1
#bridge_hw 00:11:22:33:44:55
nameserver 127.0.0.1
# CAKE / Uplink shaping
post-up tc qdisc add dev enp9s0 root cake bandwidth 80Mbit docsis nat ack-filter
pre-down tc qdisc del dev enp9s0 root
@joneskoo
joneskoo / keybindings.json
Created August 7, 2019 18:07
VS code prefs
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "shift+cmd+l",
"command": "editor.action.insertCursorAtEndOfEachLineSelected",
"when": "editorTextFocus"
},
{
"key": "shift+cmd+c",
"command": "workbench.action.terminal.toggleTerminal"
@joneskoo
joneskoo / gist:812505
Created February 5, 2011 15:05
ident-lookup.py
#!/usr/bin/env python
# Ident lookup for incoming connections
# RFC 1413 - Identification Protocol
import socket
def lookup_ident(host, server_port, client_port):
s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
s.settimeout(1)
try:
s.connect((host, 113))