Skip to content

Instantly share code, notes, and snippets.

carles san agustin carlessanagustin

Block or report user

Report or block carlessanagustin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@carlessanagustin
carlessanagustin / generate_dregistry.sh
Last active Mar 29, 2019
Generate Docker Registry resource for Kubernetes - wget -O - https://bit.ly/2EepgOX | bash -s K8S_NAMESPACE DOCKER_HUB_USERNAME DOCKER_HUB_PASSWORD DOCKER_HUB_EMAIL SECRET_NAME
View generate_dregistry.sh
#!/usr/bin/env bash
: '
USAGE:
wget -O - <URL> | \
bash -s <kubectl namespace> <secret name> <docker hub username> <docker hub password> <docker hub email>
'
NS=$1
SNAME=$2
@carlessanagustin
carlessanagustin / hello_world_k8s.sh
Last active Dec 18, 2018
Hello World Ingress in Kubernetes
View hello_world_k8s.sh
#!/usr/bin/env bash
: '
We'll see...
* Pod replicas
* Helm: The Kubernetes Package Manager
* Ingress resource: Exposes HTTP and HTTPS routes from outside the cluster to services within the cluster.
'
NS_HELLO=hello
@carlessanagustin
carlessanagustin / psql_go.sh
Last active Dec 5, 2018
Postgresql database and user creation - wget -O - https://bit.ly/2AOIw22 | bash -s <DB_HOST> <DB_NAME> <DB_USER> <DB_PASS>
View psql_go.sh
#!/usr/bin/env bash
DB_HOST=$1
DB_NAME=$2
DB_USER=$3
DB_PASS=$4
psql "sslmode=verify-ca sslrootcert=server-ca.pem sslcert=client-cert.pem sslkey=client-key.pem hostaddr=$DB_HOST port=5432 user=postgres" << EOF
CREATE DATABASE $DB_NAME ;
CREATE USER $DB_USER WITH ENCRYPTED PASSWORD '$DB_PASS' ;
@carlessanagustin
carlessanagustin / check.sh
Last active Nov 22, 2018
Quick check OS, CPU, BITS, MEMORY and DISKS configuration - wget -O - https://bit.ly/2S2Av0m | bash
View check.sh
#!/usr/bin/env bash
echo
echo ">>>>>>>>>>>>>>>>> OS"
echo COMMAND: lsb_release -d
lsb_release -d
echo
echo ">>>>>>>>>>>>>>>>> CPU"
echo COMMAND: grep -c ^processor /proc/cpuinfo
@carlessanagustin
carlessanagustin / k8s_user.sh
Last active Mar 29, 2019
Configure k8s for local user - wget -O - https://goo.gl/QY8HnC | bash -s USERNAME
View k8s_user.sh
#!/usr/bin/env bash
: '
From root or sudoer user...
USAGE:
wget -O - URL | bash -s USERNAME
'
USERNAME=$1
LOCATION=/home/$USERNAME
@carlessanagustin
carlessanagustin / .tmux.conf
Last active Oct 16, 2018
Custom TMUX - curl -L https://goo.gl/xDv6Hv -o $HOME/.tmux.conf
View .tmux.conf
# split panes using | and -, make sure they open in the same path
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %
@carlessanagustin
carlessanagustin / logrotate_setup.sh
Last active Dec 20, 2018
Logrotate setup - apply: wget -O - https://bit.ly/2PkCV8J | sudo bash -s <LOGS_FOLDER> <FILENAME>
View logrotate_setup.sh
#!/usr/bin/env bash
LOGS_FOLDER=$1
FILENAME=$2
DEST_FOLDER=/etc/logrotate.d
cat << EOF > $DEST_FOLDER/$FILENAME
$LOGS_FOLDER/*.log {
rotate 7
size 100M
@carlessanagustin
carlessanagustin / dockerlog_setup.sh
Last active Dec 20, 2018
Docker log setup - apply: wget -O - https://goo.gl/x86FN9 | sudo bash
View dockerlog_setup.sh
#!/usr/bin/env bash
# empty log file: echo "" > $(docker inspect --format='{{.LogPath}}' <container_name_or_id>)
# apply: wget -O - https://goo.gl/x86FN9 | sudo bash
FILEPATH=/etc/docker/daemon.json
cat << EOF > $FILEPATH
{
"log-driver": "json-file",
@carlessanagustin
carlessanagustin / install_gsutils.sh
Last active Nov 27, 2018
Install & setup Google SDK tools in Ubuntu
View install_gsutils.sh
#!/usr/bin/env bash
export SOURCE_FOLDER=/tmp
export DESTINATION_FOLDER=tmp
export BUCKET=backup_bucket
#echo "lalalalalala" > /tmp/lala.txt
# Service Account role: roles/storage.objectAdmin = Storage Object Admin
export KEY=Service_Account.json
export NEWUSER=mybackup
@carlessanagustin
carlessanagustin / Dockerfile
Last active Aug 8, 2018
Netcat in a Docker container
View Dockerfile
FROM alpine:latest
RUN apk add --no-cache netcat-openbsd
ENTRYPOINT [ "nc" ]
# usage...
# build: docker build -t netcat:latest .
# server: docker run --rm -p <hostPort>:<containerPort> netcat:latest -l <port>
# client: docker run --rm netcat:latest <hostname> <remotePort>
You can’t perform that action at this time.