Skip to content

Instantly share code, notes, and snippets.

View remijouannet's full-sized avatar
🦆
.

Remi Jouannet remijouannet

🦆
.
View GitHub Profile
@remijouannet
remijouannet / build.sh
Created April 23, 2015 21:31
Little bash script to sign an apk and install it with ADB
if [[ -e "$1" ]];then
cp $1 app-debug.apk
rm app-debug2.apk
rm ~/.android/debug.keystore
~/android/sdk/build-tools/21.1.1/zipalign -v 4 app-debug.apk app-debug2.apk
keytool -genkey -v -keystore ~/.android/debug.keystore \
-alias sample -keyalg RSA -keysize 2048 -validity 20000
jarsigner -verbose -keystore ~/.android/debug.keystore app-debug2.apk sample
jarsigner -verify app-debug2.apk
~/android/sdk/platform-tools/adb install app-debug2.apk
@remijouannet
remijouannet / rc.local
Created April 27, 2015 14:04
Display IP and Kernel info /etc/issue
IPADD=$(ip addr show | grep inet)
echo "\S
Kernel \r on an \m
$IPADD
" > /etc/issue
@remijouannet
remijouannet / bash_check.sh
Last active August 29, 2015 14:24
execute a command and check the return code
#!/bin/bash
function check {
if [ $debug = false ];then error=$($@ 2>&1);exitcode=$?;fi
if [ $debug = true ];then $@;exitcode=$?;fi
if [ $exitcode -ne 0 ] ;
then
echo $error;
exit $exitcode ;
@remijouannet
remijouannet / mirror_gitlab.sh
Last active August 29, 2015 14:24
mirror all the repositories of a gitlab group/person on a remote folder
#!/bin/bash
function args {
d=false;
while getopts ":h:g:d" opt "$@"; do
case $opt in
h)
h=$OPTARG;
;;
@remijouannet
remijouannet / getops.sh
Last active August 29, 2015 14:24
bash_getops
function args {
d=false;
while getopts ":h:g:d" opt "$@"; do
case $opt in
h)
h=$OPTARG;
;;
g)
g=$OPTARG;
@remijouannet
remijouannet / autossh_mysql.sh
Created July 8, 2015 12:55
(that's fucking ugly)
#!/bin/bash
ssh -l root 0.0.0.0 "mysql --host=127.0.0.1 --port=8887 --user=root --password=password --execute='exit'";
exitcode1=$?;
if [ $exitcode1 -ne 0 ]
then
nohup ssh -l root 0.0.0.0 "nohup ssh -N -l root 0.0.0.2 -L 8887:127.0.0.1:3306 &" &
PID1=$!;
echo "1"
#!/bin/bash
#author : Rémi Jouannet
#Date : 29/07/2015
#####################################################################################################################
#before launching this script, don't forget to kill gunicorn that you may have previously launch without this script#
#####################################################################################################################
PID='/tmp/yolo_gunicorn.pid';
VENV='~/venv-demo/yolo/';
SRC_WWW='~/www-demo/yolo/';
#!/bin/bash
#author : Rémi Jouannet
#Date : 31/10/2015
SRC_WWW="$(dirname "$0")"
DATE_FORMAT="%Y-%m-%d %H:%M:%S"
PROGRAM="demo_program"
#this function will execute any cmd pass to it
#if the exitcode of the cmd isn't 0 the script exit
#!/bin/bash
#author : Rémi Jouannet
#Date : 30/10/2015
which sudo;exitcode=$?
if [ $exitcode -ne 0 ]
then
apt-get install sudo
fi
#!/bin/bash
#author : Rémi Jouannet
#Date : 31/10/2015
SRC_WWW='"$(dirname "$0")"'
DATE_FORMAT="%Y-%m-%d %H:%M:%S"
PROGRAM="demo_project"
#this function will execute any cmd pass to it
#if the exitcode of the cmd isn't 0 the script exit