Skip to content

Instantly share code, notes, and snippets.

View guanhuaw's full-sized avatar

GuanhuaW guanhuaw

  • University of Michigan
View GitHub Profile
@CMCDragonkai
CMCDragonkai / python_setuptools.md
Last active April 6, 2023 13:20
Python Setuptools (Packaging Guidelines) #python

Python Setuptools

Python setuptools package replaces the distutils package. You use this in order to allow your Python package to be redistributable. Not just for PyPi but also for source distributions or private distributions.

First you need a setup.py at your project root:

@jay-johnson
jay-johnson / Setting up X11 for use on an EC2 host.md
Last active January 20, 2024 02:37
Setting up X11 for use on an EC2 host

Run this on EC2 host

  1. Set these attributes in /etc/ssh/sshd_config
# cat /etc/ssh/sshd_config  | grep X11
X11Forwarding yes 
X11DisplayOffset 10
X11UseLocalhost yes 
@scy
scy / opening-and-closing-an-ssh-tunnel-in-a-shell-script-the-smart-way.md
Last active December 9, 2025 10:53
Opening and closing an SSH tunnel in a shell script the smart way

Opening and closing an SSH tunnel in a shell script the smart way

I recently had the following problem:

  • From an unattended shell script (called by Jenkins), run a command-line tool that accesses the MySQL database on another host.
  • That tool doesn't know that the database is on another host, plus the MySQL port on that host is firewalled and not accessible from other machines.

We didn't want to open the MySQL port to the network, but it's possible to SSH from the Jenkins machine to the MySQL machine. So, basically you would do something like

ssh -L 3306:localhost:3306 remotehost