Skip to content

Instantly share code, notes, and snippets.

@simonbru
simonbru / Readme.txt
Last active January 6, 2024 13:05 — forked from endolith/Readme.txt
This is a Python script to extract GNOME/GTK's color scheme and apply it to Wine, so that the themes (approximately) match.
Instructions:
1. Set your Gnome theme as you would like it
2. Run with a command like "python wine_colors_from_gtk.py"
3. Restart any apps running in Wine. They should match the Gnome theme colors now.
Better description with screenshots here: http://www.endolith.com/wordpress/2008/08/03/wine-colors/
This is also stored on https://code.launchpad.net/~endolith/+junk/wine-color-scraper
@simonbru
simonbru / spotify-open
Last active June 29, 2022 13:20
Open spotify URLs in open Spotify instance
#!/bin/sh
# CLI wrapper that works around a bug with Spotify's handling of URIs.
# See https://community.spotify.com/t5/Desktop-Linux/Linux-Spotify-URI-only-opens-start-page/m-p/1675578#M1812
uri="$1"
echo "Trying to play: \"$uri\""
if ! qdbus org.mpris.MediaPlayer2.spotify \
/org/mpris/MediaPlayer2 \
org.mpris.MediaPlayer2.Player.OpenUri \
@simonbru
simonbru / localepurge.hook
Created February 12, 2016 02:15
ALPM (pacman) hook for localepurge
[Trigger]
Operation = Install
Operation = Upgrade
Type = File
Target = usr/share/doc/kde/HTML/*
Target = usr/share/gnome/help/*
Target = usr/share/locale/*
Target = usr/share/man/*
Target = usr/share/omf/*
@simonbru
simonbru / app.py
Created August 11, 2021 14:02
Django project in one file
import sys
from django.conf import settings
settings.configure(
DEBUG=True,
SECRET_KEY="thisisthesecretkey",
ROOT_URLCONF=__name__,
MIDDLEWARE_CLASSES=(
"django.middleware.common.CommonMiddleware",
@simonbru
simonbru / debug_trans.py
Last active February 3, 2021 13:02
Context manager to emphasize Django translated strings
import contextlib
from django.utils import translation
from django.utils.safestring import SafeData, SafeText
def prefix_decorator(function):
def prefix_wrapper(*args, **kwargs):
result = function(*args, **kwargs)
wrapped_result = "[[ " + result + " ]]"
# if isinstance(result, SafeData):
@simonbru
simonbru / sort_todos.py
Last active February 12, 2020 20:43
Sort todo.txt file according to multiple critera.
#!/usr/bin/env python3
"""
Sort todo.txt file according to multiple critera.
Depends on todotxt-machine
"""
import argparse
import datetime
@simonbru
simonbru / saleor_productCreate.har
Last active January 6, 2020 12:39
HAR for saleor issue with product permissions #5138
{
"log": {
"version": "1.2",
"creator": {
"name": "Firefox",
"version": "72.0"
},
"browser": {
"name": "Firefox",
"version": "72.0"
@simonbru
simonbru / wireguard-nat-redirect.md
Last active January 2, 2020 06:35
Redirect TCP traffic to a box behind NAT with Wireguard

Redirect TCP traffic to a box behind NAT with Wireguard

We have a web server on a box without direct access from the internet (e.g. behind a CGNAT). We want to use a box with a public IP address (such as a cheap VPS) as a gateway that will redirect HTTP traffic to the web server. We will setup a Wireguard VPN to enable bidirectional traffic between both boxes, as well as a few routing/NAT rules to redirect HTTP traffic.

Setup

Install Wireguard and wg-quick on both boxes: https://www.wireguard.com/install/

Keybase proof

I hereby claim:

  • I am simonbru on github.
  • I am simonbru (https://keybase.io/simonbru) on keybase.
  • I have a public key whose fingerprint is D671 15C4 621A 5826 0F3C 181B 4151 AA35 EEEE 1E46

To claim this, I am signing this object:

@simonbru
simonbru / README.md
Created January 24, 2019 17:25
Set a different default browser for every workspace

Custom browser launcher

Usage

  • Install xdotool
  • Modify launch_browser.sh to use the right browser for the right workspace
  • Change the path to launch_browser.sh in launch-browser.desktop
  • Copy launch-browser.desktop into ~/.local/share/applications/
  • Set this script as the default browser: xdg-settings set default-web-browser launch-browser.desktop