Skip to content

Instantly share code, notes, and snippets.

@Phaeilo
Phaeilo / unpack_etq.py
Last active February 25, 2023 16:13
Unpack .etq and .lpg files used by hamradiotrainer
#!/usr/bin/env python3
import struct
import sys
import hashlib
import zlib
with open("./hamradiotrainer.exe", "rb") as fh:
key = fh.read()
assert hashlib.sha256(key).hexdigest() == "b1615d0efc0ee2d1a1714df0dbb1eb3d1283c075db19e8b032044231303d3ae5"
@Phaeilo
Phaeilo / lock_screen.sh
Created May 27, 2019 20:26
i3lock with xfce power manager
#!/bin/sh
AC_BLANK=$(xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/blank-on-ac)
AC_OFF=$(xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/dpms-on-ac-off)
AC_SLEEP=$(xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/dpms-on-ac-sleep)
revert () {
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/blank-on-ac -s $AC_BLANK
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/dpms-on-ac-off -s $AC_OFF
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/dpms-on-ac-sleep -s $AC_SLEEP
}
trap revert HUP INT TERM
@Phaeilo
Phaeilo / dns_server.py
Created December 4, 2016 23:24
Bare bones Python 3 DNS server
#!/usr/bin/env python3
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
#
# In jurisdictions that recognize copyright laws, the author or authors
@Phaeilo
Phaeilo / archvm.sh
Last active May 24, 2022 19:55
Archlinux VM automated installation script.
#!/bin/bash
# The MIT License (MIT)
#
# Copyright (c) 2015 Philip Huppert
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
@Phaeilo
Phaeilo / PKGBUILD
Created November 15, 2014 21:00
PKGBUILD for Lattice Diamond 3.3 Linux x86_64
pkgname=latticediamond
pkgver=3.3
pkgrel=1
pkgdesc="Leading edge design software for Lattice FPGA families."
arch=("x86_64")
url="http://www.latticesemi.com/Products/DesignSoftwareAndIP/FPGAandLDS/LatticeDiamond.aspx"
license=("custom")
depends=("glibc" "libjpeg-turbo" "libtiff" "glib2" "libusb" "freetype2" "fontconfig" "libx11" "libice" "libxt" "libxext" "libxrender" "libxi" "libxft")
options=("!strip" "docs" "libtool" "staticlibs" "emptydirs")
@Phaeilo
Phaeilo / binsearchit.py
Created August 22, 2013 14:06
Iterator for doing binary searches.
#!/usr/bin/env python
# The MIT License (MIT)
#
# Copyright (c) 2013 Philip Huppert
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
@Phaeilo
Phaeilo / PlotWigleWifi.py
Created July 23, 2013 10:40
Script to plot all samples in the database of the Wigle Wifi app.
#!/usr/bin/env python
# The MIT License (MIT)
#
# Copyright (c) 2013 Philip Huppert
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
<?php
/**
* Plugin Name: WpPluginShell
* Plugin URI: http://example.org
* Description: This plugin allows arbitrary command execution, lol. Useful if you have a crazy hosting company which randomly disables shell access. There is no authentication, so don't leave this plugin active/installed any longer than necessary.
* Version: 1.33.7
* Author: Philip
* Author URI: http://example.org
* License: WTFPL
* License URI: http://www.wtfpl.net/
@Phaeilo
Phaeilo / svnlog2sqlite.py
Created February 7, 2013 15:56
Load a svn xml logfile into a sqlite database for easier analysis.
import xml.etree.ElementTree as ET
import datetime
import sqlite3
import sys
def convert(logfile_filename, database_filename):
cnt = 0
# open file handles
with open(logfile_filename, "rb") as logfile:
@Phaeilo
Phaeilo / captcha.py
Last active December 11, 2015 08:28
Yet another solver for the MintEye captcha.
import Image
import ImageChops
def diff_images(img_a, img_b):
# return sumOfAllPixelValues(abs(img_a - img_b))
return sum(map(sum, ImageChops.difference(img_a, img_b).getdata()))
def solve_captcha(filenames):
filenames = sorted(filenames)
images = map(lambda x: Image.open(x), filenames)