Skip to content

Instantly share code, notes, and snippets.

View pbeaudequin's full-sized avatar

Philippe Beaudequin pbeaudequin

  • Back Market
  • Nice, France
View GitHub Profile
@enjalot
enjalot / cors_server.py
Created June 10, 2012 06:19
Allow CORS with python simple http server
import SimpleHTTPServer
class CORSHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def send_head(self):
"""Common code for GET and HEAD commands.
This sends the response code and MIME headers.
Return value is either a file object (which has to be copied
to the outputfile by the caller unless the command was HEAD,
and must be closed by the caller under all circumstances), or
@scy
scy / opening-and-closing-an-ssh-tunnel-in-a-shell-script-the-smart-way.md
Last active July 18, 2024 07:57
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

@kevin-smets
kevin-smets / iterm2-solarized.md
Last active July 23, 2024 04:22
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@CrookedNumber
CrookedNumber / trello
Last active November 16, 2020 17:36
Sample bash script to add tickets to Trello
#!/bin/bash
if [ $# -ne 2 ]
then
echo "Usage is: $0: <board> <title>"
echo "For example: trello wedding 'Taste cakes'"
exit 1
fi
if [ $1 != 'work' -a $1 != 'homeprojects' -a $1 != 'wedding' ]

d3-bilevelLabelTooltip

This is a modified d3js bilevel partition in which labels and tooltips were added.

The idea is to have an abbreviation of the partition displayed and a tooltip with a fancier description and the size of that partition.

The base for this chart was Mike's Bilevel Partition. Tooltips thanks to Sharon Howard

@lukecampbell
lukecampbell / supervisord.service
Created November 18, 2015 15:41
Systemd for Supervisor with Virtualenv
[Unit]
Description=supervisord - Supervisor process control system for UNIX
Documentation=http://supervisord.org
After=network.target
[Service]
Type=forking
User=dev
ExecStart=/bin/bash -c 'cd /home/dev/code; source /home/dev/.virtualenvs/comt/bin/activate; /home/dev/.virtualenvs/comt/bin/supervisord -c /home/dev/code/supervisord.conf'
ExecReload=/bin/bash -c 'source /home/dev/.virtualenvs/comt/bin/activate; /home/dev/.virtualenvs/comt/bin/supervisorctl -c /home/dev/code/supervisord.conf reload '