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 / 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:8864822
Last active August 29, 2015 13:56
Update apache after upgrading Ubuntu to 13.10

Apache 2.4 now use .conf files for vhost, so you need to upgrade your old vhost

for name in `ls /etc/apache2/sites-available|grep -v conf`;do 
    sudo mv /etc/apache2/sites-available/$name /etc/apache2/sites-available/$name.conf ;
done
@jmeyo
jmeyo / view_daflash.sh
Last active August 29, 2015 13:56
Watch streamed videos from chromium with VLC (Youtube/Dailymotion or any Streaming platform) (from https://github.com/beaudev/view-da-flash/blob/master/view_da_flash.sh)
#!/bin/bash
# That function could be added to your bash_profile for example
# send all the current videos loaded in your chromium browser or in Firefox into a vlc instance byt calling at any time "view_daflash"
view_daflash(){
SAVE_IT=
com_func_file=$( dirname "${BASH_SOURCE[0]}" )/common_functions.sh
if [ ! -f ${com_func_file} ]; then
curl -sSL https://raw.github.com/jmeyo/CommonBashScripts/master/common_functions.sh >${com_func_file}
# I managed to get the compiled version with patched QT working on ubuntu precise 64bit (12.04 LTS) and thought I'd share my bash history in the hopes it might spare others some trouble shooting.
# Also note that this install process takes rather long, you might want to consider running it in a screen or something
# you will be needing git if you haven't got it yet
sudo apt-get install git-core
# as per installation instructions, install dependencies for wkhtmltopdf
sudo apt-get install openssl build-essential xorg libssl-dev libxrender-dev
# clone the repo
git clone git://github.com/antialize/wkhtmltopdf.git wkhtmltopdf
@jmeyo
jmeyo / gist:9483785
Last active August 29, 2015 13:57
Docker commands stylesheet

remove docker instances which have exited

sudo docker ps -a -notrunc | grep 'Exit' | awk '{print $1}' | xargs -r sudo docker rm

Get Ip of all running instances

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 ',"')
@jmeyo
jmeyo / search_utils.sh
Last active August 29, 2015 13:57
extended search based on egrep
#!/bin/bash
function sf() {
[ -z "$1" ] && echo -e "Nothing to search, give string\n" && return
str=$1
path=${2:-.}
find $path -type f | xargs egrep -i "$str"
}
@jmeyo
jmeyo / install-dacorp-symfony-manager.sh
Last active August 29, 2015 13:57
Installer for dacorp symfony manager
#!/bin/bash -x
# https://github.com/jmeyo/dacorp-symfony-manager installer script
if [ "x"$USER != 'x' ]; then
if [ "x"$USER != 'xroot' ]; then
sm_path=$HOME/.symfony-manager
else
sm_path=/root/.symfony-manager
fi
else
sm_path=/root/.symfony-manager
var http = require('follow-redirects').http;
//top 1000
var domains = ["google.com","facebook.com","youtube.com","yahoo.com","baidu.com","wikipedia.org","qq.com","linkedin.com","live.com","twitter.com","amazon.com","blogspot.com","taobao.com","google.co.in","sina.com.cn","wordpress.com","yahoo.co.jp","yandex.ru","bing.com","ebay.com","google.de","vk.com","hao123.com","163.com","tumblr.com","pinterest.com","google.co.uk","google.fr","googleusercontent.com","microsoft.com","msn.com","ask.com","mail.ru","google.co.jp","google.com.br","weibo.com","apple.com","paypal.com","google.ru","instagram.com","google.com.hk","xvideos.com","blogger.com","google.it","tmall.com","google.es","imdb.com","soso.com","craigslist.org","sohu.com","360.cn","go.com","amazon.co.jp","stackoverflow.com","bbc.co.uk","xhamster.com","google.com.mx","neobux.com","google.ca","fc2.com","cnn.com","imgur.com","alibaba.com","wordpress.org","flickr.com","espn.go.com","adcash.com","huffingtonpost.com","odnoklassniki.ru","t.co","conduit.com","thepira
@jmeyo
jmeyo / beaudev_mysql_tools.sh
Last active August 29, 2015 14:00
docker beaudev/mysql alias + backup
#!/bin/bash
docker_beaudev_mysql_instance=`sudo docker ps | grep "beaudev/mysql" | nawk '{print $1}'`
if [ "x"$docker_beaudev_mysql_instance != "x" ]; then
alias beaudev_mysql_admin_pass="echo "$(sudo docker logs $docker_beaudev_mysql_instance | grep "mysql -uadmin" | nawk '{print $3}' | sed 's/^-p//')
alias beaudev_mysql_ip="echo "$(sudo docker inspect --format '{{ .NetworkSettings.IPAddress }}' $docker_beaudev_mysql_instance)
function backup_beaudev_mysql() {
[ ! -d ~/beaudev_mysql/ ] && mkdir -p ~/beaudev_mysql/
@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