Skip to content

Instantly share code, notes, and snippets.

@echo off
rem Windows version of http://gist.github.com/320272
if "%1" == "" goto noargs
set MODULE_LOCATION=
for /f %%f in ('python -c "import %1; print %1.__file__.rstrip('c')"') do set MODULE_LOCATION=%%f > NUL 2>&1
if "%MODULE_LOCATION%" == "" goto nomodule
@enlavin
enlavin / which.py
Created November 8, 2010 16:31
Simple "which" implementation in python featuring partial matching
#!python.exe
"""which command substitute with partial matching search"""
import glob
import os
import sys
try:
partial_fname = sys.argv[1]
except IndexError:
print "which.py <filename>"
./boost/wave/grammars/cpp_expression_value.hpp: In member function ‘typename boost::spirit::classic::match_result<ScannerT, ContextResultT>::type boost::spirit::classic::impl::concrete_parser<ParserT, ScannerT, AttrT>::do_parse_virtual(const ScannerT&) const [with ParserT = boost::spirit::classic::alternative<boost::spirit::classic::action<boost::spirit::classic::rule<boost::spirit::classic::scanner<std::_List_const_iterator<boost::wave::cpplexer::lex_token<boost::wave::util::file_position<boost::wave::util::flex_string<char, std::char_traits<char>, std::allocator<char>, boost::wave::util::CowString<boost::wave::util::AllocatorStringStorage<char, std::allocator<char> >, char*> > > > >, boost::spirit::classic::scanner_policies<boost::spirit::classic::skip_parser_iteration_policy<boost::spirit::classic::alternative<boost::spirit::classic::alternative<boost::spirit::classic::chlit<boost::wave::token_id>, boost::spirit::classic::chlit<boost::wave::token_id> >, boost::spirit::classic::chlit<boost::wave::token_id>
@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
@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 / 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 / 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 / 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 / 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)
// ==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() {