Skip to content

Instantly share code, notes, and snippets.

View KhoaTheBest's full-sized avatar

Khoa Le KhoaTheBest

  • UK
View GitHub Profile
@KhoaTheBest
KhoaTheBest / delete-vpc.sh
Created July 22, 2021 02:23 — forked from cjp/delete-vpc.sh
Delete AWS VPC including dependencies
#!/bin/sh
#
# Delete a VPC and its dependencies
if [ -z "$1" ] then
echo "usage: $0 <vpcid>"
exit 64
fi
vpcid="$1"
@KhoaTheBest
KhoaTheBest / install-docker.md
Created March 4, 2020 03:54 — forked from npearce/install-docker.md
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command
@KhoaTheBest
KhoaTheBest / plambda.yaml
Created February 10, 2020 09:52 — forked from sihil/plambda.yaml
Snippet of some CloudFormation resources for Plambda
API:
Type: AWS::ApiGateway::RestApi
Properties:
Name:
Fn::Join:
- " "
- - Restorer Plambda
- Ref: Stage
Description: Experimental Restorer Play app in Lambda
@KhoaTheBest
KhoaTheBest / mysql_cheatsheet.md
Last active December 19, 2018 08:15
MySQL cheatsheet

1. Access mysql bypass login

Note: Stop mysql service before exec

- sudo mkdir /var/run/mysqld; sudo chown mysql /var/run/mysqld
- sudo mysqld_safe --skip-grant-tables&
- sudo mysql --user=root mysql
- mysql> update user set authentication_string=PASSWORD('new-password') where user='root';
- mysql> update user set plugin="mysql_native_password" where User='root';
- mysql> flush privileges;

1. Add additional comments or files to last commit

git add missed-file.txt
git commit --amend

2. Change branch name

# 1. Clear retry set
Sidekiq::RetrySet.new.clear
# 2. Clear scheduled jobs
Sidekiq::ScheduledSet.new.clear
# 3. Clear 'Processed' and 'Failed' jobs
@KhoaTheBest
KhoaTheBest / gist:13eebe4c273f89b6075bd4a9e5bd1f1d
Created April 16, 2018 03:49 — forked from alex-zige/gist:5795358
Rails Rspec API Testing Notes

Rails Rspec APIs Testing Notes

Folders Structure

  spec
  |--- apis #do not put into controllers folder. 
        |--- your_api_test_spec.rb  
  |--- controllers
  |--- models
  |--- factories
 |--- views
@KhoaTheBest
KhoaTheBest / rails_api_setup_steps.md
Last active April 10, 2018 10:29
How to setup Rails API + Mongoid + RSpec
  • Generating Rails API app: $ rails new <app_name> --api -C -T
    • --api:
    • --C: Skip Action Cable files
    • --T: Skip test files
@KhoaTheBest
KhoaTheBest / GIF-Screencast-OSX.md
Created January 11, 2017 15:08 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application: