Skip to content

Instantly share code, notes, and snippets.

@misteio
misteio / PythonTricks.py
Last active March 12, 2018 08:49
Python Tricks
# Different ways to test multiple
# flags at once in Python
x, y, z = 0, 1, 0
if x == 1 or y == 1 or z == 1:
print('passed')
if 1 in (x, y, z):
print('passed')
@misteio
misteio / tunnelSSHMySQLDump.sh
Last active August 29, 2015 14:01
Dump MySQL Throught SSH Tunnel
#!/bin/bash
#
# SSH Connection with kill itself
#
# set some variables
#Tunnel ssh
ec2rebond=""
ec2rebondkey=""
@misteio
misteio / sync.sh
Last active August 29, 2015 14:01
Sync File + Sync DataBase from Local To Another Server
#!/bin/bash
#
# run as a cron job to synchronize Files + SQL Right Tables from the local server to live amazon server.
#
# set environment
dt=`date +%d%m%Y`
timenow=`date +%T`
logfile="sync.log"
errfile="sync.err"
machine=`hostname`
@misteio
misteio / Bash Commands
Last active August 18, 2021 11:11
Bash Commands
##install deb file
sudo dpkg -i *.deb
## In real time info
tail -f fichierdelog
###Change time
sudo ln -sf /usr/share/zoneinfo/Europe/Paris /etc/localtime
###DUMP SQL AMAZON
cd /mydir
unlink current
ln -s releases/${BUILD_NUMBER} current
cd /var/www/html
unlink current
ln -s releases/${BUILD_NUMBER} current
num=${BUILD_NUMBER}
x=4