Skip to content

Instantly share code, notes, and snippets.

View leoluk's full-sized avatar

leoluk leoluk

View GitHub Profile
@leoluk
leoluk / rmk-web.sh
Created February 23, 2019 11:40
Remarkable remote Web UI login
#!/bin/bash
sudo ip addr add 10.11.99.1/32 dev lo
ssh rmk true
ssh -O forward -L 10.11.99.1:8080:10.11.99.1:80 rmk
gnome-open http://10.11.99.1
sudo socat TCP-LISTEN:80,reuseaddr,fork,su=nobody TCP:10.11.99.1:8080
@leoluk
leoluk / custom_middleware.py
Created January 24, 2019 19:46
Netbox OAuth Login
"""
Custom LOGIN_REQUIRED middleware which allows OAuth URLs.
"""
import utilities.middleware
from django.conf import settings
class CustomLoginRequiredMiddleware(utilities.middleware.LoginRequiredMiddleware):
def __call__(self, request):
@leoluk
leoluk / journal-reactor.py
Created October 3, 2018 22:19
Example code that demonstrates how to listen to journald using Python 3 + asyncio.
#!/usr/bin/python3 -u
import asyncio
import sh
from systemd import journal
from systemd.daemon import notify
GATEWAY_IP = "192.168.10.1"
@leoluk
leoluk / nma.py
Created August 8, 2012 17:17
NotifyMyAndroid shell command result notification
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: http://github.com/leoluk
# License: GPLv3
#
"""
This quick-and-dirty script notifies you once a long-running shell command finishes,
using NotifyMyAndroid.com.