Skip to content

Instantly share code, notes, and snippets.

# This script does what it's supposed to: it opens multiple tunnels with different ports on the SSH host and handles them
# concurrently and it can react to the port that is being accessed by the client.
import threading
import time
import paramiko
import select
import queue
user = input('username')
@tatome
tatome / mlp.py
Created February 11, 2016 21:19
# coding=utf-8
#
#!/usr/bin/python2
#
# Copyright 2013 Johannes Bauer, Universitaet Hamburg
#
# This file is free software. Do with it whatever you like.
# It comes with no warranty, explicit or implicit, whatsoever.
#
# If you find this code useful or if you have any questions, do not
@tatome
tatome / som.py
Created February 11, 2016 21:17
# coding=utf-8
#
#!/usr/bin/python2
#
# Copyright 2013 Johannes Bauer, Universitaet Hamburg
#
# This file is free software. Do with it whatever you like.
# It comes with no warranty, explicit or implicit, whatsoever.
#
# This python script implements a simple SOM in arbitrary dimensions.
@tatome
tatome / saliency.py
Created February 11, 2016 20:29
Simple Itty-Koch-Style Saliency Maps
# coding=utf-8
#
#!/usr/bin/python
#
# Copyright 2013 Johannes Bauer, Universitaet Hamburg
#
# This file is free software. Do with it whatever you like.
# It comes with no warranty, explicit or implicit, whatsoever.
#
# This python script implements an early version of Itti and Koch's
@tatome
tatome / plot_rgb_as_pcolormesh
Last active March 12, 2021 07:24
Plot any RGB image as as pcolormesh in matplotlib's pcolormesh
import numpy as np
def plot_as_colormesh(image, axes, **pcolormeshkwargs):
raveled_pixel_shape = (image.shape[0]*image.shape[1], image.shape[2])
color_tuple = image.transpose((1,0,2)).reshape(raveled_pixel_shape)
if color_tuple.dtype == np.uint8:
color_tuple = color_tuple / 255.
index = np.tile(np.arange(image.shape[0]), (image.shape[1],1))
#!/bin/bash
if [ $# -lt 2 ] || [ $# -gt 3 ]; then
echo usage: shrinkpdf \<filename\> \<resolution\> \[\<output\>\]
exit
fi
if [ ! -e "$1" ]; then
echo "$1" does not exist. Exiting.
exit