Skip to content

Instantly share code, notes, and snippets.

@enlavin
enlavin / Dockerfile
Created September 4, 2023 07:56
openconnect-proxy with no reconnections
FROM wazum/openconnect-proxy as base
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
@enlavin
enlavin / main.py
Last active August 19, 2022 06:23
KMK circuitpython macropad firmware
import board
#from kmk.kmk_keyboard import KMKKeyboard
#from kmk.matrix import DiodeOrientation
#from kmk.keys import KC
# Updated to be compatible with the latest KMK release (which requires CircuitPython >= 7.0)
from kmk.kmk_keyboard import KMKKeyboard
from kmk.keys import KC
from kmk.scanners import DiodeOrientation
F13::
ActivateProcess("slack.exe")
return
F14::
ActivateProcess("telegram.exe")
return
// ==UserScript==
// @name dotmain
// @namespace http://enlavin.com/
// @version 0.1
// @description Adds a dot at the end of the url domains to mess up with ads
// @author enlavin
// @match http*://*/*
// ==/UserScript==
(function() {
@enlavin
enlavin / pub_dht11.py
Created January 27, 2018 18:19
Publish temperature and humidity to a MQTT topic using a NodeMCU + Micropython and a DHT11
import dht
import machine
import network
import utime
from umqtt.simple import MQTTClient
NODEMCU_PINS = (16, 5, 4, 0, 2, 14, 12, 13, 15, 3, 1, 9, 10)
d = dht.DHT11(machine.Pin(NODEMCU_PINS[4]))
sta_if = network.WLAN(network.STA_IF)
@enlavin
enlavin / monitor_fermentation.py
Last active June 21, 2022 16:34
Telegram bot to monitor temperatures. Created to itch my scratch of wanting to monitor the temperature of a brewing vessel using ESP8266/DS18B20 and a mosquitto broker. Temperatures are logged using RRDTOOL and recorded every 10 seconds.
import __main__
import os
import tempfile
import paho.mqtt.client as mqtt
import rrdtool
import telegram
import telegram.ext
@enlavin
enlavin / monitor_temp.py
Created December 7, 2016 19:21
Read temperature from a DS18B20 and send a message to a MQTT broker using micropython
import ds18x20
import gc
from machine import Timer, Pin
import network
import onewire
from time import sleep_ms
from umqtt.simple import MQTTClient
import urandom
@enlavin
enlavin / skinconvert.py
Created December 25, 2014 20:45
Quick and dirty Minecraft 1.7 -> 1.8 skin converter
#!/usr/bin/env python
# Quick and dirty Minecraft 1.7 -> 1.8 skin converter
# skinconvert.py oldskin.png newskin.png
from __future__ import print_function
import os
import sys
from PIL import Image
if len(sys.argv) != 3:
@enlavin
enlavin / focus_or_run_keypassx
Created January 31, 2012 13:16
Focus an existing KeePassX or start a new instance
#!/bin/sh
xwit -focus -names /home/username/path/to/passwordfile.kdb
if [ "$?" != "0" ]
then
exec keepassx /home/username/path/to/passwordfile.kdb
fi
@enlavin
enlavin / gist:1023074
Created June 13, 2011 16:08
screenrc alt + 1 -> screen 1, alt + 2 -> screen 2, etc
caption always "%{+b gk}%c %{rk}%d/%m/%Y | %?%{yk}%-Lw%?%{wb}%n*%f %t%?(%u)%?%?%{yk}%+Lw%?"
bind f eval "caption splitonly"
bind F eval "caption always"
hardstatus string "%{.kc}%-w%{.kw}%n*%t%{-}%+w %= %2` %3`/%4` %6`/%7` %5`/%9` %c%a %m/%d/%Y" #black+cyan+normal+white selected
bindkey "\033\060" select 0
bindkey "\033\302\272" select 0
bindkey "\033\061" select 1
bindkey "\033\062" select 2