Skip to content

Instantly share code, notes, and snippets.

@balda
balda / child-docker-images.sh
Created September 20, 2019 07:59
Get docker child images
#!/bin/bash
check()
{
if [ "$1" = "" ]; then
echo "Need a docker ID in argument";
exit;
fi
}
check $1
@balda
balda / bootstrap_elk.sh
Created October 1, 2014 10:14
Bootstrap ELK
#!/bin/bash
# update package repo
apt_install () {
echo "Europe/Paris" > /etc/timezone
dpkg-reconfigure -f noninteractive tzdata
# sytem upgrade
apt-get update; apt-get upgrade -y
@balda
balda / kill_node_process
Created May 29, 2014 13:32
Kill node process
ps aux | grep node
# Find the process ID (second from the left):
kill -9 PRCOCESS_ID
@balda
balda / .bash_profile
Created May 28, 2014 14:06
Bash alias (example with mongod)
# Run mongo with local config
alias mf="mongod -f /usr/local/etc/mongod.conf"
@balda
balda / npm-e
Created February 24, 2014 15:22
npm install (using EU registry)
npm install --registry http://registry.npmjs.eu
@balda
balda / .bash_profile
Last active August 29, 2015 13:55
Alias ssh. Use it with `ssh [shortcut]`. Change `.bash_profile` for shortcuts autocompletion.
[ -e "$HOME/.ssh/config" ] && complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config | grep -v "[?*]" | cut -d " " -f2 | tr ' ' '\n')" scp sftp ssh
@balda
balda / .bash_profile
Created January 31, 2014 10:15
.bash_profile on osx
#!/bin/bash
#
# CRM .bash_profile Time-stamp: "2008-12-07 19:42"
#
# echo "Loading ${HOME}/.bash_profile"
source ~/.profile # Get the paths
source ~/.bashrc # get aliases
#
#- end
@balda
balda / table_date.sql
Last active January 2, 2016 18:19
Add date insert and date update fields.
ALTER TABLE `[[_TABLE_]]` ADD `date_insert` DATETIME NOT NULL , ADD INDEX ( `date_insert` ) ;
ALTER TABLE `[[_TABLE_]]` ADD `date_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP , ADD INDEX ( `date_update` ) ;
DROP TRIGGER IF EXISTS `Trigger_DateInsert_[[_TABLE_]]`;
DELIMITER //
CREATE TRIGGER `Trigger_DateInsert_[[_TABLE_]]` BEFORE INSERT ON `[[_TABLE_]]`
FOR EACH ROW BEGIN
SET NEW.`date_insert` = NOW();