Skip to content

Instantly share code, notes, and snippets.

Avatar
💝

Kamil rollcat

💝
View GitHub Profile
View url.py
import typing as t
import urllib.parse
from functools import lru_cache
from urllib.parse import urlencode
class URL(str):
"""A URL string, with various handy accessors based on urlparse.
Go crazy:
@rollcat
rollcat / Book of Power
Created May 25, 2021
Factorio blueprints
View Book of Power
0eNrNvd1upEeSJPoqQl2Tg/j/aSzOxbneBQ727N2MILBKqRLRLLKGRWpaaOjdN5NVYiaZn4WbOVuFGaCnW6Wi0dy/CI8Icw+Pf757f/O4+3x/ffvw0/u7u7+/+9s/j3/y5d3f/v3kHw//7ufdlw/3158fru9u3/3t3f9//Y8f7ndXHx7u7r9c/PBl/0//dfWwu//h8+Onz1/+4/Z/3n28/vJw/eGHD7/uvjz88PPu5vq33f3v/3H7v+5ur/c/c3378Ydf7u5/+OVxd/PD1e3PP3x52F19+o/bdxfvrj/c3X799V+uP95e3Rx+98Pvn3f7X3r9sPu0/xu3V58O/3T7+OFmd3V/+Y3Guz/2P3v78+4f7/4W/7h4w0+nzZ/+7fr+4XH/J88AX//G5cFHJz+cpR9uJz9Z/vjx4t3u9uH64Xr31f6nf/j9p9vHT+9393urnn/68/Ue9eLd57sv118/xz/f7QEuS/u3evHu9/3/yvPf6h8HJq8gkglRLYhsQmQLopgQxYKoLyAuH+4uP97fPd7+vAWWXoBdvPv5+n734evfaBvQjYfOUYPuAvSCddqAHjx0ihr0FKCD5pAYeOwYNNox8thTpJ1oaJV0ppHFsRcLjywOkMjPxihOxsjPxiTOmMjPxpRF1vxszEWE5mdjzppDEj8ZSxGhrbXLXndSEkL+cSEcAO04z95ff7zc3ezZ319/uPx8d7O1II1vaH1v6u3u+uOv7+8e7w+LdJoXNVz0eBHzuIil/7j1u8z17jjfOqBbeQhkcTMggonQLRI2xHCEt8HMizSVD1rh98wXfVzkkPb/qRc5h60PmoMnlA5mouToCaWUh3LyhFKOdfaEUo518cQ7jnX1RGmOtTXZSrGmSu6eaAziR+bnXVG9yC9IJ0EeGF2OM+vpQHj58Hj//vp2t9yyFYZmOZlY+yPqMoK2l3BlCy6xRJvIM9MeyEcXRODOwoNlE6zSYKmbYI0HKyaYuTCdxMoCMMYJobv7q4/7kXx1+/cNrOMgzk8f9MP
@rollcat
rollcat / hotkeys.kbd.json
Last active May 21, 2022
rollcat's StarCraft II hotkeys (WIP)
View hotkeys.kbd.json
[
{
"name": "rollcat's StarCraft II hotkeys",
"author": "https://www.rollc.at/",
"notes": "https://gist.github.com/rollcat/8b8dcd36c0abccf430b4160ad899b879\n"
},
[
{
"x": 3.5,
"a": 7
@rollcat
rollcat / x11_docker_mac.md
Created Jun 27, 2020 — forked from cschiewek/x11_docker_mac.md
X11 in docker on macOS
View x11_docker_mac.md

To forward X11 from inside a docker container to a host running macOS

  1. Install XQuartz: https://www.xquartz.org/
  2. Launch XQuartz. Under the XQuartz menu, select Preferences
  3. Go to the security tab and ensure "Allow connections from network clients" is checked.
  4. Run xhost + ${hostname} to allow connections to the macOS host *
  5. Setup a HOSTNAME env var export HOSTNAME=`hostname`*
  6. Add the following to your docker-compose:
 environment:
@rollcat
rollcat / qr.sh
Created Nov 22, 2017
qrencode wrapper
View qr.sh
#!/bin/sh
set -eu
fname="`tempfile`"
cleanup() {
rm -f "$fname"
}
trap cleanup exit
qrencode -o "$fname" "$@"
feh "$fname"
@rollcat
rollcat / findbins.py
Last active Oct 5, 2017
Executable basename conflicts in Debian packages
View findbins.py
#!/usr/bin/env python3
import subprocess
import os
PATH = [
"/bin",
"/sbin",
"/usr/bin",
"/usr/sbin",
@rollcat
rollcat / python.py
Created Oct 1, 2017
An Ansible module to run arbitrary Python code
View python.py
#!/usr/bin/python
# License: Ansible's
# Example:
# ---
# - hosts: localhost
# connection: local
# gather_facts: no
# become: no
# tasks:
@rollcat
rollcat / index.html
Last active May 18, 2017
Basic auth logout hack
View index.html
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
window.onload = function() {
var logout = document.getElementById("logout");
logout.onclick = function() {
xhr = new XMLHttpRequest();
xhr.addEventListener("load", location.reload);
xhr.open("GET", location.origin + "/api/logout");
@rollcat
rollcat / Compact-laptop-keyboard-w_trackpoint.kbd.json
Last active Apr 20, 2017
Compact laptop keyboard w/trackpoint
View Compact-laptop-keyboard-w_trackpoint.kbd.json
[
{
"name": "Compact laptop keyboard w/trackpoint"
},
[
{
"h": 0.75
},
"Esc",
{
@rollcat
rollcat / reddit-sfwporn.py
Created Mar 17, 2017
reddit daily wallpaper
View reddit-sfwporn.py
#!/usr/bin/env python3
import contextlib
import logging
import mimetypes
import os
import random
import requests
import subprocess
import sys