Skip to content

Instantly share code, notes, and snippets.

View jmeyo's full-sized avatar
👸
Focusing

Jean-Christophe Meillaud jmeyo

👸
Focusing
View GitHub Profile
@jmeyo
jmeyo / beaudev_docker_aliases.sh
Last active December 31, 2017 00:03
Beaudev Docker alias and usefull functions
#!/bin/bash
# Get id, name and ip adresses of all active docker container
function do_get_ip_address() {
paste <(sudo docker ps | tail -n +2 | awk {'printf "%s\t%s\n", $1, $2 '}) <(sudo docker ps -q | xargs sudo docker inspect | tail -n +2 | grep \"IPAddress\" | awk '{ print $2 }' | tr -d ',"')
}
# stop and remove a container based on his id
function do_stop_rm_container() {
[ -z "$1" ] && echo "Give me a container ID" && return
@jmeyo
jmeyo / gist:17db055a26d8490e6e194e2012d4a64c
Last active January 11, 2017 16:29
Mautic nginx conf
server {
listen 80;
server_name mautic.somedomain.com;
root /usr/share/nginx/mautic;
index index.php;
access_log /var/log/nginx/mautic.access.log;
error_log /var/log/nginx/mautic.error.log;
@jmeyo
jmeyo / install workstation
Last active July 7, 2016 18:04
Ubuntu 16.04 install
# install useful tool
sudo apt-get install links chromium-browser chromium-browser-l10n geany geany-plugins curl screen
# Setup LEMP
→ https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-12-04
## setup mysql
sudo /usr/bin/mysql_secure_installation
sudo apt-get install php5-fpm
@jmeyo
jmeyo / beaudev_docker_nginx_proxy_host.sh
Last active May 16, 2016 10:41
Beaudev simple script to add a nginx vhost reverse proxying to a docker instance
#!/bin/bash
# add vhost reverse proxy for new docker instance for nginx and restart nginx
# use like this : do_nginx_proxy_vhost subdir.example.com http://192.168.0.20:8080
function do_nginx_proxy_vhost() {
[ -z $1 -o -z $2 ] && echo "Give host and address" && return
host=$1
address=$2
[ -f /etc/nginx/sites-available/proxy_reverse_$host ] && (echo "Updating proxy for host: $host" && sudo rm /etc/nginx/sites-enabled/proxy_reverse_$host) || echo "Creating proxy for host: $host"
server {
listen 80;
server_name __project_hosts__;
root __project_path__;
index index.php;
access_log /var/log/nginx/__project_name___project_dev.access.log;
error_log /var/log/nginx/__project_name___project_dev.error.log;
@jmeyo
jmeyo / background.js
Last active March 2, 2016 02:34 — forked from danharper/background.js
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});
@jmeyo
jmeyo / favicon.sh
Last active December 31, 2015 01:29 — forked from lavoiesl/favicon.sh
#!/bin/bash
# Converts an image in a multi-resolution favicon
# Requires Imagemagick
function generate_favicon() {
command -v convert >/dev/null 2>&1 || (echo "Imagemagick not here, install it" && return )
case "$#" in
"0")
echo "Usage: $FUNCNAME input.png output.ico"
@jmeyo
jmeyo / gist:b2e2bdb24a91e957a71f
Last active August 29, 2015 14:20
Docker Server commands
PS1='${debian_chroot:+($debian_chroot)}\u@www-nginx:\w\$ '
@jmeyo
jmeyo / gist:16f1b352b3b1c8b6251d
Last active August 29, 2015 14:18
PHP oldversion compilation on ubuntu server
TMPDIR=$( mktemp -d 2>/dev/null )
cd $TMPDIR
VERSION=5.3.29 #latest php released stable version in 5.3.X
wget http://in1.php.net/distributions/php-$VERSION.tar.bz2
tar xvf php-$VERSION.tar.bz2
cd php-$VERSION
@jmeyo
jmeyo / gist:dcff1194a0a54c0c72af
Created March 23, 2015 23:52
Install imapsync debian
apt-get update && apt-get upgrade
sudo apt-get install libdate-manip-perl libterm-readkey-perl libterm-readkey-perl libdigest-hmac-perl libdigest-hmac-perl libdate-manip-perl libmail-imapclient-perl makepasswd rcs perl-doc git
cd /tmp
git clone git://github.com/imapsync/imapsync.git
cd imapsync
sh examples/install_modules_linux.sh
apt-get install build-essential
sh examples/install_modules_linux.sh