Skip to content

Instantly share code, notes, and snippets.

View seletz's full-sized avatar

Stefan Eletzhofer seletz

View GitHub Profile
@seletz
seletz / frontmost_window.py
Created December 31, 2023 11:24 — forked from ljos/frontmost_window.py
Find the frontmost/active window in OS X
# Copyright @ Bjarte Johansen 2012
# License: http://ljos.mit-license.org/
from AppKit import NSApplication, NSApp, NSWorkspace
from Foundation import NSObject, NSLog
from PyObjCTools import AppHelper
from Quartz import kCGWindowListOptionOnScreenOnly, kCGNullWindowID, CGWindowListCopyWindowInfo
class AppDelegate(NSObject):
def applicationDidFinishLaunching_(self, notification):
@seletz
seletz / cleanup_maven_repository.sh
Created January 16, 2023 15:16 — forked from cescoffier/cleanup_maven_repository.sh
A shell script to cleanup your local maven repository. It removes all snapshot from more than 6 months
#!/bin/sh
M2_REPO=${HOME}/.m2
OLDFILES=/tmp/deleted_artifacts.txt
AGE=181 # more or less 6 months and it's a palindromic prime number, so it's cool
echo "==== To be Deleted Jars ====" >> ${OLDFILES}
find "${M2_REPO}" -name '*-SNAPSHOT*jar' -atime +${AGE} -exec dirname {} \; >> ${OLDFILES}
echo "==== To be Deleted Wars/Ears ====" >> ${OLDFILES}

Keybase proof

I hereby claim:

  • I am seletz on github.
  • I am seletz (https://keybase.io/seletz) on keybase.
  • I have a public key ASDUpiRgFWwhHifECeWfIxoffMwZubpVp-GkFp0emqRHMwo

To claim this, I am signing this object:

@seletz
seletz / ALU.vhdl
Created April 28, 2014 20:03 — forked from gigaherz/ALU.vhdl
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
use work.constants.all;
use work.ctypes.all;
entity ALU is port (
clk : in std_logic;
@seletz
seletz / fbranch
Last active August 29, 2015 13:56
Bash script which creates a feature branch and adds a comment on the github issue.
#!/bin/bash
function usage() {
echo "usage: fbranch <issue no> <tagline>..."
}
issue=$1
shift
@seletz
seletz / fix-venv
Last active December 30, 2015 10:59
bash script to fix a br0ken python virtual env after a python upgrade. Usable probably only on OS X. This script uses a known-good „p27“ virtual env — recreate this manually.
#!/bin/bash
#set -x
VENV=$1
VH=$VIRTUALENV_ROOT/$VENV
# Adjust this to the actual python version you want to convert your venv to
PYTHON_ROOT=/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7
test -d "$VIRTUALENV_ROOT/p27" || {
@seletz
seletz / callable.py
Created April 11, 2012 20:58 — forked from durden/callable.py
Clever way to use Python __call__ and __getattr__ to create web APIs that can map directly (dynamically) to actual API
class MyCallable(object):
def __init__(self, urlparts, callable):
self.urlparts = urlparts
self.callable = callable
def __call__(self, **kwargs):
print kwargs
print self.urlparts
def __getattr__(self, name):
# Return a callable object of this same type so that you can just keep
# chaining together calls and just adding that missing attribute to the