Skip to content

Instantly share code, notes, and snippets.

@nestoru
nestoru / netsuiteTokenPassportGenerator.sh
Created December 21, 2016 19:35
Netsuite tokenPassport Generator
#!/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`
@nestoru
nestoru / gitlab production installation: good bye subversion
Last active September 23, 2016 00:48
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'
@nestoru
nestoru / spring-impersonation-audit.awk
Created December 5, 2015 00:04
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");
}
@nestoru
nestoru / Solution for mysql Warning: Using a password on the command line interface can be insecure
Last active October 23, 2021 21:20
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
@nestoru
nestoru / ubuntu-install-xrdp.sh
Last active August 30, 2021 12:58
Install XRDP in Ubuntu
#!/bin/bash -e
#
# ubuntu-install-xrdp.sh
# Tested in Ubuntu 20.04: Bidirectional clipboard does work.
#
# One line installer (change ubuntu by the username that you want to remotely login):
# curl -L https://gist.github.com/nestoru/fee24a59804d60ccba1a/raw | sudo bash -s ubuntu
#
START=$(date +%s)
@nestoru
nestoru / solaris onleliner - find number of CPU cores
Created June 5, 2015 12:49
solaris onleliner - find number of CPU cores
/bin/uname -X | grep NumCPU | ggrep -o '[0-9]*'
@nestoru
nestoru / Plain Old Bash (POB) idempotent recipe to install redis
Created May 21, 2015 00:33
Plain Old Bash (POB) idempotent recipe to install redis
# install redis
cd /tmp
rm -fr redis-stable
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable
make
make install
# prepare necessary directories
@nestoru
nestoru / fastest idempotent ubuntu nodejs install
Created April 30, 2015 19:10
fastest idempotent ubuntu nodejs install
# for some reason npm does not get installed until removing and reinstalling node
add-apt-repository -y ppa:chris-lea/node.js \
&& apt-get update \
&& apt-get install -y nodejs=$version* \
&& apt-get remove -y nodejs \
&& apt-get install -y nodejs
@nestoru
nestoru / dockerized mediawiki 1.25 upgrade
Last active August 29, 2015 14:19
dockerized mediawiki 1.25 upgrade
Dockerfile.partial
==================
# Omitting apache related configuration
RUN apt-get -y update
RUN apt-get -y install imagemagick
RUN mkdir -p /var/www/wiki
RUN cd /var/www \
@nestoru
nestoru / gist:3b23bd7dabccefcd48f7
Created February 6, 2015 14:29
Setting DISPLAY variable to avoid No protocol specified Error: Can't open display: :#
# Check current DISPLAY value
$ echo $DISPLAY
:0
# If xclock fails as below the variable is incorrect
$ xclock
No protocol specified
No protocol specified
Error: Can't open display: :0
# Find the correct value for the current user session
$ xauth list|grep `uname -n`