Skip to content

Instantly share code, notes, and snippets.

Avatar
🚲
Tant que je respire, j’attaque

Nic Doye nicdoye

🚲
Tant que je respire, j’attaque
View GitHub Profile
@nicdoye
nicdoye / 7z-release.sh
Created Nov 13, 2015
7zip but exclude .git (Simples, but I don't use it that often).
View 7z-release.sh
#!/bin/bash
7z a -x'!*/.git' $1.7z $1
@nicdoye
nicdoye / mysqlbackup.sh
Created Feb 2, 2013
Backup your OpenShift MySQL database. My DB is only small so I didn't bother to compress it through a pipe. sftp it back from your local machine afterwards This is basically a quick hack from running "type mysql" on the OpenShift gear - hint: it's a bash function/alias
View mysqlbackup.sh
mkdir ~/app-root/data/tmp
mysqldump -h $OPENSHIFT_MYSQL_DB_HOST -P ${OPENSHIFT_MYSQL_DB_PORT:-3306} -u ${OPENSHIFT_MYSQL_DB_USERNAME:-'admin'} --password="$OPENSHIFT_MYSQL_DB_PASSWORD" --all-databases > ~/app-root/data/tmp//all.sql
@nicdoye
nicdoye / lc.sh
Created Jul 23, 2018
Rename files to lowercase, and change spaces to dashes.
View lc.sh
#!/bin/bash
lc() {
for i in * ; do j="$(echo $i | tr '[:upper:]' '[:lower:]' | tr ' ' '-' )" ; [ "$i" != "$j" ] && mv "$i" "$j"; done
}
@nicdoye
nicdoye / docker-java-tomcat.csv
Last active Jun 11, 2018
Docker image sizes (for a medium post)
View docker-java-tomcat.csv
Name Base OS Java Vendor JRE/JDK Tomcat Size (MiB)
alpine:3.7 Alpine 4
gcr.io/distroless/base distroless 16
openjdk:8-jre-alpine Alpine OpenJDK JRE 78
openjdk:8-jdk-alpine Alpine OpenJDK JDK 97
tomcat:8.5-alpine Alpine OpenJDK JRE 8.5 101
nicdoye/micro-tomcat-jre distroless OpenJDK JRE 8.5 142
nicdoye/micro-tomcat-jdk distroless OpenJDK JDK 8.5 179
tomcat:8.5-slim Debian Slim OpenJDK JRE 8.5 213
alfresco/alfresco-base-java:8 CentOS Oracle JDK 468
@nicdoye
nicdoye / docker-size.sh
Created Jun 8, 2018
Finding a docker image's size
View docker-size.sh
docker inspect openjdk:8-jdk-alpine | jq '.[] | "\(.Size) \(.RepoTags[0])"'
View hgweb.config
[paths]
/hg/ = /srv/hg/repos/*
[web]
style = gitweb
staticurl = /hg/static
allow_push = *
@nicdoye
nicdoye / uwsgi.ini
Created May 16, 2018
uWSGI config for mercurial
View uwsgi.ini
[uwsgi]
uid = uwsgi
gid = uwsgi
pidfile = /run/uwsgi/uwsgi.pid
emperor = /etc/uwsgi.d
stats = /run/uwsgi/stats.sock
chmod-socket = 660
emperor-tyrant = true
cap = setgid,setuid
; https://www.mercurial-scm.org/wiki/PublishRepositoriesOnNginx
@nicdoye
nicdoye / nginx-hg.conf
Last active May 16, 2018
nginx conf for Mercurial with uWSGI
View nginx-hg.conf
location /hg/ {
uwsgi_pass unix:/run/uwsgi/hgweb.sock;
include uwsgi_params;
auth_basic "Mercurial repository";
auth_basic_user_file /etc/nginx/htpasswd;
client_max_body_size 0;
}
@nicdoye
nicdoye / activemq
Last active Aug 23, 2017
Init script for activemq. Known to work on RHEL 6, probably works on RHEL 5 and SLES Relies on variables set in /etc/sysconfig/activemq
View activemq
#!/bin/bash
#
# activemq Starts ActiveMQ.
#
#
# chkconfig: 345 88 12
# description: ActiveMQ is a JMS Messaging Queue Server.
### BEGIN INIT INFO
# Provides: activemq
### END INIT INFO
@nicdoye
nicdoye / time.sh
Created Aug 9, 2017
Minutes and Seconds from milliseconds
View time.sh
# Contains a rounding error, but we didn't need the accuracy
# Check if $response is an empty string or not a number
if [ -z ${response} ] || [ $(( ${response} + 0 )) == 0 ]
then
mins=undef
secs=undef
then
else
mins=$(( ${response} / 1000 / 60 ))
secs=$(( ${response} / 1000 - 60 * ${mins} ))
You can’t perform that action at this time.