Skip to content

Instantly share code, notes, and snippets.

View hugsbrugs's full-sized avatar

Hugo Maugey hugsbrugs

View GitHub Profile
@hugsbrugs
hugsbrugs / google-memo.sh
Created February 27, 2016 12:24
Google Memo
# Query Google Cache
http://webcache.googleusercontent.com/search?q=cache:<your url without "http://">
@hugsbrugs
hugsbrugs / python-memo.sh
Created February 27, 2016 13:35
Python Memo
# PIP
# install package
pip install package
# install from git repository
pip install git+git://github.com/gvalkov/tailon.git
@hugsbrugs
hugsbrugs / tailon.sh
Last active February 28, 2016 14:53
Display Logs in Browser with tailon
# Install tailon
pip install tailon
# start tailon
tailon -f /var/log/apache2/{access,error}.log
tailon -f /var/log/apache2/{access,error}.log -b 127.0.0.1:8080 -d
# SECURE INSTALLATION
# Create a domain or subdomain like tailon.mydomain.com
# Create an apache virtual host
@hugsbrugs
hugsbrugs / jail.local
Last active March 8, 2016 17:31
Memo Linux fail2ban
[DEFAULT]
ignoreip = 127.0.0.1/8 YOUR_IP
banaction = ufw
bantime = 1800
destemail = your.name@mail.com
sendername = Fail2Ban
action = %(action_mwl)s
[sshd]
enabled = true
@hugsbrugs
hugsbrugs / scrapy-memo.sh
Created March 8, 2016 18:46
Scrapy Memo
scrapyd start <crawler>
@hugsbrugs
hugsbrugs / mysql-diff.sh
Last active April 12, 2016 13:40
Compare Mysql database
# Export first database
mysqldump --skip-comments --skip-extended-insert -u root -p database_1>file1.sql
# Export second database
mysqldump --skip-comments --skip-extended-insert -u root -p database_2>file2.sql
# Display differences between files
diff file1.sql file2.sql
# Ressource
http://www.mysqldiff.org/
@hugsbrugs
hugsbrugs / php.sh
Created April 22, 2016 07:50
PHP reminder and how too
# PHP mail change FROM (when auto set as www-data by web server)
mail([to], [subject], [message], [headers], "-f hugo@maugey.fr -F Hugo Maugey");
# Update you packages
sudo apt-get update
# Install a compiler
sudo apt-get install build-essential
# Install tcl
sudo apt-get install tcl8.5
# Download Redis
wget http://download.redis.io/releases/redis-stable.tar.gz
# Uncompress archive
tar xzf redis-stable.tar.gz
@hugsbrugs
hugsbrugs / linux-network-memo.sh
Last active April 25, 2016 20:39
Linux network memo
# See all opened ports
netstat -ntlp | grep LISTEN
#
netstat - anp
#
netstat -tulpen
# Show uwf status
sudo ufw status verbose
# Open a port
sudo ufw allow 80/tcp
@hugsbrugs
hugsbrugs / linux-crontab.sh
Last active April 26, 2016 17:37
Cron how to
# List cron tasks for user www-data
sudo crontab -u www-data -l
# Edit cron tasks for user www-data
sudo crontab -u www-data -e
# Backup current user crontab
crontab -l > cron-backup.txt
# Restore current user crontab
crontab cron-backup.txt