Skip to content

Instantly share code, notes, and snippets.

View rbrto's full-sized avatar

Roberto Esparza rbrto

View GitHub Profile
@rbrto
rbrto / postgres cheatsheet.md
Last active April 6, 2018 17:04 — forked from apolloclark/postgres cheatsheet.md
postgres cheatsheet

Postgres Cheatsheet

This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.

Setup

installation, Ubuntu

http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL

@rbrto
rbrto / restore.sh
Created June 11, 2018 01:00 — forked from jgillman/restore.sh
pg_restore a local db dump into Docker
# Assumes the database container is named 'db'
DOCKER_DB_NAME="$(docker-compose ps -q db)"
DB_HOSTNAME=db
DB_USER=postgres
LOCAL_DUMP_PATH="path/to/local.dump"
docker-compose up -d db
docker exec -i "${DOCKER_DB_NAME}" pg_restore -C --clean --no-acl --no-owner -U "${DB_USER}" -d "${DB_HOSTNAME}" < "${LOCAL_DUMP_PATH}"
docker-compose stop db
@rbrto
rbrto / install-gcloud-on-centos.sh
Created June 13, 2018 16:39
Install Google Cloud SDK on CentOS
# https://cloud.google.com/sdk/downloads#yum
sudo tee /etc/yum.repos.d/google-cloud-sdk.repo > /dev/null <<EOM
[google-cloud-sdk]
name=Google Cloud SDK
baseurl=https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
@rbrto
rbrto / bash-cheatsheet.sh
Created July 1, 2018 00:01 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@rbrto
rbrto / upgrade_ubuntu.sh
Created July 1, 2018 00:07 — forked from apolloclark/upgrade_ubuntu.sh
Upgrade Ubuntu 14.04 / 16.04 systems
#!/bin/bash
export DEBIAN_FRONTEND=noninteractive
apt-get update -q
apt-get update -q
apt-get upgrade -q -y
apt-get dist-upgrade -y
apt-get autoremove -y
@rbrto
rbrto / elasticsearch.md
Created July 12, 2018 01:08 — forked from nicolashery/elasticsearch.md
Elasticsearch: updating the mappings and settings of an existing index

Elasticsearch: updating the mappings and settings of an existing index

Note: This was written using elasticsearch 0.9.

Elasticsearch will automatically create an index (with basic settings and mappings) for you if you post a first document:

$ curl -X POST 'http://localhost:9200/thegame/weapons/1' -d \
'{
  "_id": 1,
@rbrto
rbrto / jenkins-notes.md
Created January 21, 2019 12:58 — forked from misterbrownlee/jenkins-notes.md
Jenkins setup

I just had to set up Jenkins to use GitHub. My notes (to myself, mostly):

Detailed Instructions

For setting up Jenkins to build GitHub projects. This assumes some ability to manage Jenkins, use the command line, set up a utility LDAP account, etc. Please share or improve this Gist as needed.

Install Jenkins Plugins