Skip to content

Instantly share code, notes, and snippets.

@pamtrak06
pamtrak06 / gist:5b8831c172b254a60eb986430e79a6aa
Created June 5, 2016 09:46
Javascript useful libraries
# (Codemirror)[http://codemirror.net/]
CodeMirror is a versatile text editor implemented in JavaScript for the browser.
@pamtrak06
pamtrak06 / check-user-exist-on-host.sh
Created November 26, 2017 00:10
bash script for mac osx user creation commmands
function findCurrentOSType()
{
osType=$(uname)
case "$osType" in
"Darwin")
echo "OS: MacOSX detected"
;;
"Linux")
echo "OS: Linux detected"
;;
@pamtrak06
pamtrak06 / generate-parameters-list-for-envsubst.sh
Created November 26, 2017 00:16
generate list of variables from a properties file, for envsubst
# generate list of variables from a properties file
# form : \$VARIABLE
# give it to envsubst command to avoid escaping others variable in template file
function generate-parameters-list-for-envsubst {
type=$1
local pts
local pindex
unset parameters
pts=$(cat $properties|grep export|cut -d "=" -f 1|sed "s/export //g")
@pamtrak06
pamtrak06 / check_jboss_is_running.sh
Created December 3, 2017 20:49
bash script to check if jboss 7.1.1 is running
#!/bin/bash
function check_jboss_is_running() {
echo "INFO: Waiting for JBoss to startup..."
echo -n "INFO: starting "
while [ ! -f "${JBOSS_HOME}/logs/server.log" ]; do
sleep 1
echo -n "#"
done
echo -n "-log-"
#!/bin/bash
# wait-for-postgres.sh
# source : https://docs.docker.com/compose/startup-order/
set -e
host="$1"
shift
cmd="$@"
yum update -y && yum -y install yum-utils
# Example for downloading rpm
declare -a arr=("nc.x86_64" "curl" "wget" "mlocate" "sudo" "dos2unix" "tar" "unzip" "passwd")
for p in "${arr[@]}"; do { yumdownloader $p; } done;
declare -a arr=(curl-7.19.7-53.el6_9.x86_64.rpm nc-1.84-24.el6.x86_64.rpm tar-1.23-15.el6_8.x86_64.rpm
dos2unix-3.1-37.el6.x86_64.rpm passwd-0.77-7.el6.x86_64.rpm unzip-6.0-5.el6.x86_64.rpm
mlocate-0.22.2-6.el6.x86_64.rpm sudo-1.8.6p3-29.el6_9.x86_64.rpm wget-1.12-10.el6.x86_64.rpm)
@pamtrak06
pamtrak06 / yum_dependencies.sh
Created December 5, 2017 17:51
yum retrieve dependencies
#!/bin/bash
rpm -q --requires $1
@pamtrak06
pamtrak06 / raspbian-apt-get-update.sh
Created December 16, 2017 10:03
raspbian: force ipv4 for apt-get update and apt-get upgrade
#!/bin/bash
apt-get -o Acquire::ForceIPv4=true -y update
apt-get -o Acquire::ForceIPv4=true -y dist-upgrade
@pamtrak06
pamtrak06 / raspbian-rpi-update.sh
Created December 16, 2017 10:15
Raspbian : install rpi-update, run it and reboot
sudo apt-get -y update
sudo apt-get -y install rpi-update
sudo rpi-update
sudo reboot
@pamtrak06
pamtrak06 / raspbian-docker-installations.sh
Last active December 16, 2017 11:20
raspbian : docker, docker-compose and docker-machine installation
# docker installation
curl -sSL get.docker.com | sh
# docker-compose installation
pip install docker-compose
# fix issue "memory cgroup not supported"
# https://github.com/moby/moby/issues/35587
# replace/adding "cgroup_enable=memory cgroup_memory=1" in /boot/cmdline.txt & reboot