Skip to content

Instantly share code, notes, and snippets.

View hannes-brt's full-sized avatar

Hannes Bretschneider hannes-brt

View GitHub Profile
@hannes-brt
hannes-brt / hexify-unhexify.el
Created November 26, 2010 19:51
URL escapes and unescapes strings
;; Interactive functions to hexify and unhexify urls
(defun hexify-region (start end)
(interactive "r")
(let ((hex-string (url-hexify-string
(filter-buffer-substring start end))))
(delete-region start end)
(insert hex-string)))
(defun unhexify-region (start end)
(interactive "r")
@hannes-brt
hannes-brt / latex-picture.el
Created November 26, 2010 20:03
Turns a math expression in Latex-format into a png to be used in a markdown document
;; Turn region into Latex-picture
(defun latex-picture (start end)
(interactive "r")
(let ((hex-string (url-hexify-string
(filter-buffer-substring start end))))
(delete-region start end)
(insert (concat "![](http://www.sitmo.com/gg/latex/latex2png.2.php?z=100&eq="
hex-string
")"))))
@hannes-brt
hannes-brt / pyximport_numpy.py
Created December 28, 2010 13:08
Setup pyximport to include the numpy headers
import pyximport
import numpy as np
pyximport.install(setup_args={'include_dirs': np.get_include()})
@hannes-brt
hannes-brt / git-branch.sh
Created November 23, 2012 22:43
Show git-branch in prompt
# Show git-branch in prompt
c_cyan=`tput setaf 6`
c_red=`tput setaf 1`
c_green=`tput setaf 2`
c_sgr0=`tput sgr0`
parse_git_branch ()
{
if git rev-parse --git-dir >/dev/null 2>&1
then
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hannes-brt
hannes-brt / gist:4688151
Last active December 12, 2015 00:59
Readbase API example
{
"metadata": {
"name": "Map Bodymap STAR"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@hannes-brt
hannes-brt / ipy_hide_input
Created August 12, 2013 00:20
This is a simple command line tool that adds a small snippet of Javascript to the end of the HTML output of `ipython nbconvert` that hides the input code in the output. This works for both '--to html' and '--to slides' The tool works both when given a file name or by reading from stdin: ```bash ipy_hide_input input_file.slides.html ipython nbcon…
#! /usr/bin/env python
"""
The MIT License (MIT)
Copyright (c) 2013 Hannes Bretschneider
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
### Keybase proof
I hereby claim:
* I am hannes-brt on github.
* I am hannes_brt (https://keybase.io/hannes_brt) on keybase.
* I have a public key whose fingerprint is E0CD EEFA 5AA1 E8AD 3CDB F5B4 B6CB 4CC5 5250 D9C4
To claim this, I am signing this object:
@hannes-brt
hannes-brt / gist:f163015ac781e118c3e0
Created November 24, 2014 15:48
Query busy GPUs
nvidia-smi | grep -A 1000 'Compute processes' - | tail -n+4 | grep '^|' | cut -f 5 -d ' '
IMAGE _/nginx