Skip to content

Instantly share code, notes, and snippets.

@awd
awd / gist:1529838
Created December 28, 2011 21:28 — forked from datwright/gist:1355453
SOCKS Proxy for remote FTP server
OH NO! It turns out that simple one-port SSH Tunnels won't work for FTP since it uses another random port to actually transfer data. No problem! SOCKS Proxy to the rescue!
This assumes that you have SSH access to a server that can successfully connect to the FTP server you want access to.
On your local execute (if you have a woople ssh alias setup):
ssh -ND 1234 woople
You'll need an FTP client that supports SOCKS Proxies. I recommend Filezilla. Enter localhost:1234 as your SOCKS proxy server and connect to the FTP server using its regular internet address (as though you were connecting from your production server). SWEEEET!
@hrldcpr
hrldcpr / tree.md
Last active January 6, 2025 22:43
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@walkermatt
walkermatt / debounce.py
Created June 4, 2012 21:44
A debounce function decorator in Python similar to the one in underscore.js, tested with 2.7
from threading import Timer
def debounce(wait):
""" Decorator that will postpone a functions
execution until after wait seconds
have elapsed since the last time it was invoked. """
def decorator(fn):
def debounced(*args, **kwargs):
def call_it():
@jkp
jkp / websocketserver.py
Created July 18, 2012 13:28
A simple WebSockets server with no dependencies
import struct
import SocketServer
from base64 import b64encode
from hashlib import sha1
from mimetools import Message
from StringIO import StringIO
class WebSocketsHandler(SocketServer.StreamRequestHandler):
magic = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'
@dbartow
dbartow / gist:166114161e0c438600db
Last active November 9, 2016 10:59
Setting up an IPython / IJulia notebook server on Ubuntu Server 14.04.1 'trusty' for IPython Development
IPython Installation
1. Install Git
1. sudo apt-get install git
2. Install IPython from GitHub server
1. git clone --recursive https://github.com/ipython/ipython.git (this clones the git repo into a directory called ‘ipython’ located in the directory you run the command from)
3. Run the IPython setup script
1. cd into the ‘ipython’ directory created in the previous step
2. sudo python setup.py install
4. Set up a self-signed certificate for SSL (still results in warning in the browser but allows for SSL)
@baraldilorenzo
baraldilorenzo / readme.md
Last active January 14, 2025 11:07
VGG-16 pre-trained model for Keras

##VGG16 model for Keras

This is the Keras model of the 16-layer network used by the VGG team in the ILSVRC-2014 competition.

It has been obtained by directly converting the Caffe model provived by the authors.

Details about the network architecture can be found in the following arXiv paper:

Very Deep Convolutional Networks for Large-Scale Image Recognition

K. Simonyan, A. Zisserman

@erikbern
erikbern / install-tensorflow.sh
Last active June 26, 2023 00:40
Installing TensorFlow on EC2
# Note – this is not a bash script (some of the steps require reboot)
# I named it .sh just so Github does correct syntax highlighting.
#
# This is also available as an AMI in us-east-1 (virginia): ami-cf5028a5
#
# The CUDA part is mostly based on this excellent blog post:
# http://tleyden.github.io/blog/2014/10/25/cuda-6-dot-5-on-aws-gpu-instance-running-ubuntu-14-dot-04/
# Install various packages
sudo apt-get update
@bishboria
bishboria / springer-free-maths-books.md
Last active March 24, 2025 13:36
Springer made a bunch of books available for free, these were the direct links
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maartenbreddels
maartenbreddels / ipython_thread.py
Last active July 28, 2020 14:07
IPython snippet for doing work in a thread, and updating a progressbar
import threading
from IPython.display import display
import ipywidgets as widgets
import time
def get_ioloop():
import IPython, zmq
ipython = IPython.get_ipython()
if ipython and hasattr(ipython, 'kernel'):
return zmq.eventloop.ioloop.IOLoop.instance()
ioloop = get_ioloop()