View gce-instance-container-public-ip.sh
for line in $(gcloud compute instances list | \
grep -v NAME | awk '{print $1}'); \
do echo $line; (gcloud compute ssh $line -- curl -s ifconfig.co); \
done &&
for line in $(kubectl get pods | \
grep -v NAME | awk '{print $1}'); \
do echo $line; (kubectl exec -ti $line -- curl -s ifconfig.co); \
done
View fullstack javascript class diagram
sudo npm install wavi -g
node `which wavi` /path/to/api /tmp/api.svg
node `which wavi` /path/to/fe /tmp/frontend.svg
View aws-cross-region-replicate-all-lambda.py
# aws-cross-region-replicate-all-lambda.py
# @author: Nestor Urquiza
# @date: 20161226
# @description: Cross Region replication script. Use at your own risk!
# Customize this lambda looking for TOCHANGETHIS: identifier
import boto3
import botocore
from pprint import pprint
View MSSQL From Linux
# To install tsql: sudo apt install freetds-bin
TDSVER=8.0 tsql -H $host -p $port -D $database -U $user -P
View netsuiteTokenPassportGenerator.sh
#!/bin/bash -e
# netsuiteTokenPassportGenerator.sh
# @author: Nestor Urquiza
# @date: 20121221
account=******
consumerKey=********
token=*********
nonce=`cat /dev/urandom | env LC_CTYPE=C tr -dc 'a-zA-Z0-9' | fold -w 20 | head -n 1`
timestamp=`date +%s`
View gitlab production installation: good bye subversion
# Installation
* See the restore instructions if you need to restore from backups
* Make sure /srv/gitlab/ is completely removed in the host
* Use the below ~/docker-compose.yml file. The gitlab root user takes effect *only* for brand new installations
```
gitlab:
image: 'gitlab/gitlab-ce:8.7.0-ce.0'
restart: always
hostname: 'gitlab.sample.com'
container_name: 'gitlab'
View spring-impersonation-audit.awk
#!/usr/bin/awk
# spring-impersonation-audit.awk
# author: Nestor Urquiza
# date: 20151123
# description: Lists users and impersonated users per request
{
if(!usernames[$8] && match($0,"login.*j_username")){
usernames[$8]=gensub(/^.*j_username=([^& ]*)[& ].*$/,"\\1","g");
}
View Solution for mysql Warning: Using a password on the command line interface can be insecure
# Let us consider the following typical mysql backup script:
mysqldump --routines --no-data -h $mysqlHost -P $mysqlPort -u $mysqlUser -p$mysqlPassword $database
# It succeeds but stderr will get:
# Warning: Using a password on the command line interface can be insecure.
# You can fix this with the below hack:
credentialsFile=/mysql-credentials.cnf
echo "[client]" > $credentialsFile
echo "user=$mysqlUser" >> $credentialsFile
echo "password=$mysqlPassword" >> $credentialsFile
View ubuntu-install-xrdp.sh
#!/bin/bash -e
#
# ubuntu-install-xrdp.sh
#
# Uses X11RDP-o-Matic to install XRDP
# Installs LXDE desktop. Use X11RDP-o-Matic ./RDPsesconfig.sh to use a different desktop
# Hopefully Unity will be supported again. (See https://bugs.launchpad.net/ubuntu/+source/gnome-session/+bug/1251281)
# Tested in Ubuntu 14.04.2: Bidirectional clipboard works!!!
View solaris onleliner - find number of CPU cores
/bin/uname -X | grep NumCPU | ggrep -o '[0-9]*'