Skip to content

Instantly share code, notes, and snippets.

View bchewy's full-sized avatar
:octocat:
writing terraform....

Brian Chew bchewy

:octocat:
writing terraform....
View GitHub Profile
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:GetObject"
],
@bchewy
bchewy / gist:e03ec4bbde42637be2f761eea3d996ff
Created April 15, 2021 12:34
useful mongodb commands
# show databases
show dbs
# use database (sample_training)
use sample_training
# show collections in database
show collections

Handy Docker Commands!

  • docker ps -a # shows all containers and their statuses, stopped, up for x hours, etc!
  • docker stop $(docker ps -a -q) # Stops all running containers.
  • docker build . # Builds current dockerfile in directory into a docker image
  • docker-compose up -d --build # builds from docker-compose.yml, and runs as daemon.

Tagging docker images & pushing

  • docker images
  • docker tag <imageid> bchewy/repo_name:tagname
  • docker push bchewy/repo_name
@bchewy
bchewy / gist:a97ac5279fcd2bd25bf182a4bb9e5db4
Created December 13, 2019 14:39
Installing NodeJS 12.x on Ubuntu 19.x
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt install -y nodejs
@bchewy
bchewy / gist:be417b1ddb3edd71cf76dc24a0172af8
Last active December 13, 2019 14:45
Installing Docker on Ubuntu 19.x
# Simple script to install docker - you need to check some values to enable this to work
sudo apt update
sudo apt remove docker docker-engine docker.io
sudo apt install docker.io # return Y to install
sudo systemctl start docker
sudo systemctl enable docker
docker --version # Checks what docker version
@bchewy
bchewy / .zshrc
Last active November 20, 2019 06:12
### ZShell
# Brian's Config for ZShell
# Enable colors and change prompt:
autoload -U colors && colors
PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "
# History in cache directory:
HISTSIZE=10000
SAVEHIST=10000
@bchewy
bchewy / readme.md
Last active November 13, 2019 08:30
writing selenium test cases with pytest on Django.

Writing selenium test cases with pytest on Django.

This document is not written in any particular order. It is ordered in sections

  • Tips for using the Selenium WebDriver
  • Using the pytest command on the CLI
  • Configurating Pytest for Django

Follow at your own risk!

Tips for using the Selenium WebDriver

  1. Make sure to use driver methods to see where you're at!
@bchewy
bchewy / rsync_tmbackup.sh
Created August 10, 2019 07:52
Rsync Backup - taken from rsync tmbackup
#!/usr/bin/env bash
APPNAME=$(basename $0 | sed "s/\.sh$//")
# -----------------------------------------------------------------------------
# Log functions
# -----------------------------------------------------------------------------
fn_log_info() { echo "$APPNAME: $1"; }
fn_log_warn() { echo "$APPNAME: [WARNING] $1" 1>&2; }
@bchewy
bchewy / cheatsheet.md
Last active July 31, 2019 07:09
RSpecs cheatsheet

RSpec Cheatshet

This gist will give you a quick insight on how you can write unit tests with rspec!

Mini-topics covered:

  • Defining test cases
  • Writing your own factory
  • Mocking methods/classes
  • Expected test results;
  • Writing controller specs
  • Before you do....