Skip to content

Instantly share code, notes, and snippets.

View HariSekhon's full-sized avatar
🏠
Digital Nomad

Hari Sekhon HariSekhon

🏠
Digital Nomad
View GitHub Profile
@HariSekhon
HariSekhon / ssh-tunnelling.md
Created March 22, 2024 01:19
ssh-tunnelling.md from HariSekhon/Knowledge-Base repo: https://github.com/HariSekhon/Knowlege-Base

SSH Tunnelling

Generic SSH Port Forwarding

SSH login to host1 and bind local port number to forward through the ssh tunnel to host2 on the specified port.

ssh -L <local_port>:<host2>:<host2_port> <user>@<host1>
@HariSekhon
HariSekhon / solr.md
Created March 22, 2024 01:19
solr.md from HariSekhon/Knowledge-Base repo: https://github.com/HariSekhon/Knowlege-Base
@HariSekhon
HariSekhon / snowflake.md
Created March 22, 2024 01:19
snowflake.md from HariSekhon/Knowledge-Base repo: https://github.com/HariSekhon/Knowlege-Base

Snowflake

SnowPipe

--use role snowpipe_role;
use database demo_db;

create or replace stage demo_db.public.snowstage
    url='s3://snowflake-oregon/'
@HariSekhon
HariSekhon / shell.md
Created March 22, 2024 01:19
shell.md from HariSekhon/Knowledge-Base repo: https://github.com/HariSekhon/Knowlege-Base

Shell

  • Bash - the gold standard in shell scripting - see bash.md
  • Bourne - the original unix shell - Bash is the Bourne Again Shell - next generation Bourne shell
  • Ksh - Korn shell - another old unix shell
  • Tcsh - BSD shell - just use Bash
  • Zsh - slightly more feature rich shell than Bash. Not sure it's worth the hassle aside from ** directory recursion globbing
  • Fish - friendly interactive shell - meaning user friendly

Fish

@HariSekhon
HariSekhon / sbt.md
Created March 22, 2024 01:19
sbt.md from HariSekhon/Knowledge-Base repo: https://github.com/HariSekhon/Knowlege-Base
@HariSekhon
HariSekhon / regex.md
Created March 22, 2024 01:19
regex.md from HariSekhon/Knowledge-Base repo: https://github.com/HariSekhon/Knowlege-Base

Regex

Regular expressions are a core skill for any half decent programmer.

I use them extensively in languages from Python and Perl to Java/Scala/Groovy and even in shell scripts in Bash for grep, sed & awk.

Online Regex Testing

https://regex101.com/

@HariSekhon
HariSekhon / redhat.md
Created March 22, 2024 01:19
redhat.md from HariSekhon/Knowledge-Base repo: https://github.com/HariSekhon/Knowlege-Base

Redhat

RHEL / CentOS / Fedora / Rocky Linux

Redhat is one of the original Linux distributions.

Unfortunately they discontinued their free Redhat distribution replacing it with a commercially licensed Redhat Enterprise Linux (RHEL) and a less stable desktop-focused Fedora Linux in the mid 2000s.

Community volunteers reacted by creating CentOS from RHEL source rpms to maintain a clone of stable redhat enterprise linux

@HariSekhon
HariSekhon / python.md
Created March 22, 2024 01:19
python.md from HariSekhon/Knowledge-Base repo: https://github.com/HariSekhon/Knowlege-Base

Python

Python is a popular and easy to use general purpose programming language that is heavily used in Data Analytics and Data Science as well as systems administration.

It's not as amazing for one-liners are Perl is though, which can boost shell scripts more easily.

Core Reading

Learning Python

@HariSekhon
HariSekhon / programming.md
Created March 22, 2024 01:19
programming.md from HariSekhon/Knowledge-Base repo: https://github.com/HariSekhon/Knowlege-Base

Programming

Languages

  1. Bash - the gold standard for shell scripting
  2. Python - general purpose object oriented language, easy to write, widely used but hard to maintain due to environment differences, language and library changes over time
  3. Golang - imperative compiled self-contained binaries, simple toolchain, smashes Python in portability, maintainability, build time etc.
  4. Perl - fast to write imperative code, stable, the gold standard for regex string processing, works everywhere and doesn't break every few years like Python
  5. Groovy - a better version of Java, with interactive REPL and some language construct conveniences. Hard to want to write in Java again after getting spoilt by Groovy
  6. Java - battle tested, but slower to develop in than the above languages
@HariSekhon
HariSekhon / podman.md
Created March 22, 2024 01:19
podman.md from HariSekhon/Knowledge-Base repo: https://github.com/HariSekhon/Knowlege-Base

Podman & Buildah by Redhat

Podman

  • manages containers without a daemon
  • non-root daemonless drop-in replacement for Docker
  • drop in replacement for Docker CLI command
yum install -y podman