Skip to content

Instantly share code, notes, and snippets.

See Editor:
- $ echo $EDITOR
Flow:
- $ CTRL + U (Cut everything to beginning of line)
- $ insert something at the beginning, e.g. sudo
- $ CTRL + Y (Paste what was cut)
Go to beginning:
- $ CTRL + A
Create Executable:
- $ go build <filename>.go
Create Binaries and executables:
- $ go install <filename>.go
Run file:
- $ go run <filename>.go
Run multiple file:
@StuartsHome
StuartsHome / Linux_Networking
Last active March 27, 2021 18:11
Linux and Bash networking commands
# Netstat
Display process/service running on specified port
- $ netstat -na | grep "8080"
or
- $ lsof -i :8080 //returns the PID (process id) that runs on port 8080
Kill process/service running on specified port
PID
- $ kill <pid>
@StuartsHome
StuartsHome / Git Useful
Last active April 8, 2021 14:08
Useful commands that are not related to workflow, terminal-cheat sheet, etc.
# Workflow - work on coworker's branch
1. `fetch` all remote branches
- $ git fetch origin
2. Check branch available for checkout
- $ git branch -a
3. Make local copy of branch
- $ git checkout -b <name-your-branch> origin/<name-of-remote-branch>
Remove file from GitHub - remove from index:
@StuartsHome
StuartsHome / postgres
Last active April 9, 2021 19:30
PostgreSQL commands
To start:
- $ psql
Create DB:
- $ CREATE DATABASE <name>;
Connect to DB:
- $ \c <dbname>
List all dbs:
As of Kafka 2.2, you can instead use --bootstrap-server localhost:9092 in your kafka topics command
kafka-topics:
- $ kafka-topics --bootstrap-server localhost:9092 --topic <name> --create --partitions 3 --replication-factor 1
- (127.0.0.1:9092)
List topics:
- $ kafka-topics --bootstrap-server localhost:9092 --list
@StuartsHome
StuartsHome / VSCode Shortcuts
Last active March 11, 2021 17:20
VScode MAC shortcuts
Key Commands:
------------------
Delete Line:
Shift + Cmd + K
Copy Line Down/Up:
Shift + Opt + Down
Shift + Opt + Up
Insert cursor:
@StuartsHome
StuartsHome / Install_Java
Last active March 8, 2021 18:09
Installation of Java on macOS
Install JDK - also installs JRE
1. Verify if Java is installed
1.1 In Terminal type: $ java -version
2. Install Java JDK
2.1 Open .dmg folder
2.2 Open .pkg folder
3. Set Java Home env variable
3.1 Quit Terminal and re-open to refresh session
3.2 Query current java home path using Commands 1.
3.3 Open ~/.bash_profile
@StuartsHome
StuartsHome / Docker Commands and Info
Last active February 20, 2021 11:24
Docker Commands and Info
Build image - go to the root directory where the image is located:
$ docker build -t <imagename> .
Run Container:
$ docker run -d -p 5000:5000 <imagename>
Query the container port to see if running:
$ docker ps
$ curl http://localhost:5000
@StuartsHome
StuartsHome / terminal-cheat-sheet.txt
Last active February 28, 2021 17:21 — forked from cferdinandi/terminal-cheat-sheet.txt
Terminal Cheat Sheet
# My Additions
Add remotes:
- $ git remote add <shortname> <url>
Create branch:
- $ git branch <newbranchname>
Switch branch:
- $ git checkout <branchname>
Altogether: