Skip to content

Instantly share code, notes, and snippets.

@simonbru
simonbru / saleor_productCreate.har
Last active Jan 6, 2020
HAR for saleor issue with product permissions #5138
View saleor_productCreate.har
{
"log": {
"version": "1.2",
"creator": {
"name": "Firefox",
"version": "72.0"
},
"browser": {
"name": "Firefox",
"version": "72.0"
@simonbru
simonbru / wireguard-nat-redirect.md
Last active Jan 2, 2020
Redirect TCP traffic to a box behind NAT with Wireguard
View wireguard-nat-redirect.md

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/

@simonbru
simonbru / sort_todos.py
Last active Feb 12, 2020
Sort todo.txt file according to multiple critera.
View sort_todos.py
#!/usr/bin/env python3
"""
Sort todo.txt file according to multiple critera.
Depends on todotxt-machine
"""
import argparse
import datetime
View keybase.md

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 Jan 24, 2019
Set a different default browser for every workspace
View README.md

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
@simonbru
simonbru / picklestream.py
Created Apr 26, 2018
Stream pickled python objects through TCP (unsafe)
View picklestream.py
#!/usr/bin/env python3
import pickle
import socket
import sys
def server():
serversocket = socket.socket(
socket.AF_INET, socket.SOCK_STREAM
@simonbru
simonbru / README.md
Last active Mar 31, 2018
GNOME: Use alternative notification service
View README.md

GNOME: Use alternative notification service

The GNOME-Shell process hosts its own notification service, which makes it a bit tricky to use a different one. The following hacks worked fine for GNOME 3.26.

Instructions

Find and install a notification daemon that is able to steal the notification bus name from GNOME-Shell, and make it start with the session. I used the daemon from the notification-daemon package with the --replace parameter. I start the daemon from an infinite loop because it exits after a few minutes of inactivity. To use the same setup as mine, copy notification-daemon.desktop into ~/.config/autostart/.

If your notifications daemon only implements the org.freedesktop.Notifications D-BUS interface, you need to prevent GNOME-Shell to own the org.gtk.Notifications bus name.

@simonbru
simonbru / webremote.py
Last active Oct 4, 2017
mpd-web-remote
View webremote.py
#!/usr/bin/env python3
import re
from subprocess import check_call, check_output
from bottle import get, post, run, redirect, request
def retrieve_volume():
output = check_output(['mpc', 'volume'])
@simonbru
simonbru / redditbackup.sh
Last active Jul 7, 2016
Script using curl and jq to backup reddit saved links/comments
View redditbackup.sh
#!/bin/bash -eu
# This script requires curl and jq>=1.5
export LC_ALL=C
curl='curl --user-agent RedditBackup -L'
fetch_saved() {
# Try to load credentials.conf if FEED_URL is not set
@simonbru
simonbru / README.md
Created Jun 6, 2016 — forked from cdhowie/README.md
DNS proxy to fix Netflix stupidity
View README.md

fix-netflix-dns

This is a DNS server that intentionally returns an empty result set for any AAAA query for netflix.com or any subdomain thereof. The intent is to force Netflix to use IPv4 in cases where Netflix has blocked IPv6 access -- specifically, for Hurricane Electric users who find Netflix giving them the error:

You seem to be using an unblocker or proxy. Please turn off any of these services and try again. For more help, visit netflix.com/proxy.

You can’t perform that action at this time.