Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@thvitt
thvitt / register-jupyter-env
Last active March 31, 2023 16:26
Register a jupyter kernel for the current pyenv.
#!/bin/sh
if [ "$PYENV_VERSION" -ne "" ]
then
name=`pyenv version-name`
python=`pyenv which python`
else
name=`basename "$VIRTUAL_ENV"`
python="$VIRTUALENV/bin/python"
fi
@thvitt
thvitt / git-cor
Created April 25, 2016 09:38
Recursively checkout branches of the same name from a git module and its submodules
#!/bin/bash
export SUBDIRECTORY_OK=1
dashless=$(basename "$0" | sed -e 's/-/ /')
OPTIONS_SPEC="$dashless [-p] [branch]
$dashless looks through the issue's commit message and code for for referenced
issues and opens the configured chili project info for them. Use 'git config
chili.url' to configure the root url.
--
@thvitt
thvitt / summarize-calabash-profile.xsl
Created March 10, 2015 17:11
Summarizes a profiling file as output by xmlcalabash to a sortable HTML table.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://thorstenvitt.de/functions"
exclude-result-prefixes="xs"
xpath-default-namespace="http://xmlcalabash.com/ns/profile"
version="2.0">
<xsl:output method="xhtml" include-content-type="yes"/>
@thvitt
thvitt / summarize-java-versions.sh
Created June 5, 2014 11:48
Reports on the Java class versions in an Eclipse RCP app.
#!/bin/sh
# This is a simple script to check every class file that somehow got into a
# Eclipse RCP application for its required java version.
#
# Run it in a RCP or p2 repo directory and it checks every .class file in the
# plugins for the required java version using file(1). The results will be
# written to two (redundant) reports.
#
# The script is able to handle standard bundled plugins as well as expanded
@thvitt
thvitt / mkexec.sh
Created May 5, 2014 08:19
A script that, for each argument, creates a shell script that calls `exec ‹argument› "$@"` in the current directory. Useful instead of symlinks for commands that refer to `$0` but that do not resolve symlinks.
#!/bin/sh
help() {
cat <<EOF
$0 /path/to/target/program ...
Creates a simple executable that forwards to the target program in the current
directory.
EOF
@thvitt
thvitt / pom.xml
Last active December 20, 2015 05:29
A POM file to mirror a (composite) p2 repository and create a simple one out of it. Requires Maven 3, uses Tycho Extras.Use the properties to configure it first.
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>info.textgrid</groupId>
<artifactId>mirrortest</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<prerequisites>
<maven>3.0.0</maven>
</prerequisites>
@thvitt
thvitt / mw2confluence.pl
Created September 24, 2012 16:45
A very simple and incomplete Perl script to convert some parts of MediaWiki syntax to Confluence Wiki syntax
#!/usr/bin/perl
# This is a very very simplistic converter that takes a subset of MediaWiki
# syntax and converts it to confluence syntax. Currently supported are
# headings, simple text formatting, links, and code blocks; lists will work
# as-is. I do not guarantee for anything, this will probably need manual
# adjustments, but it should help with the tedious task of converting stuff
# from our old wiki to the new one.
use strict;
@thvitt
thvitt / sscreen.sh
Created November 25, 2011 11:15
A wrapper around screen(1) that forwards the SSH agent
#!/bin/sh
if [ -n "$SSH_AUTH_SOCK" -a -S "$SSH_AUTH_SOCK" ]
then
ln -sf "$SSH_AUTH_SOCK" "$HOME/.ssh/auth-socket"
SSH_AUTH_SOCK="$HOME/.ssh/auth-socket"
fi
exec screen "$@"