This repository holds everything I thought interesting keeping record of 🤷
-
Bash aliases
-
fzf : an interactive Unix filter fuzzy finder for command-line that can be used with any list; files, command history, processes, hostnames, etc... ;
-
To dump multiline inputs into a file directly from a terminal, one needs to use
<<
operator as such:$ cat << EOF > filename.yml ... content: of: "file" ... EOF
-
As an alternative to
find
,fd
is written in Rust and drastically more efficient ; -
As an enhanced alternative to
cat
,bat
is written in Rust and supports a large number of languages syntax hightligthing ; -
entr
is a nice independent utility for running arbitrary commands when files change ; -
To have eternal history in bash, add the following to your
~/.bashrc
:# Eternal bash history. # --------------------- # Undocumented feature which sets the size to "unlimited". # http://stackoverflow.com/questions/9457233/unlimited-bash-history export HISTFILESIZE= export HISTSIZE= export HISTTIMEFORMAT="[%F %T] " # Change the file location because certain bash sessions truncate .bash_history file upon close. # http://superuser.com/questions/575479/bash-history-truncated-to-500-lines-on-each-login export HISTFILE=~/.bash_eternal_history # Force prompt to write history after every command. # http://superuser.com/questions/20900/bash-history-loss PROMPT_COMMAND="history -a; $PROMPT_COMMAND"
Moreover, you need to make sure that no other file such as
~/.profile
or~/.bash_profile
setsHISTFILESIZE
orHISTSIZE
environment variables. -
direnv
is a shell extension. It adds a new feature that can load and unload environment variables depending on the current directory. -
To open any new terminal in the directory that was visited last, simply add the following lines at the end of your
~/.bashrc
:PROMPT_COMMAND="$PROMPT_COMMAND; pwd > \"${XDG_RUNTIME_DIR}/.cwd\"" [[ -f "${XDG_RUNTIME_DIR}/.cwd" ]] && cd "$(< ${XDG_RUNTIME_DIR}/.cwd)"
And add the following line to your
~/.bash_profile
, in order to reset the.cwd
when you open a new session:echo ${HOME} > \"${XDG_RUNTIME_DIR}/.cwd\""
-
A handy shell script that permits writing automated repeatable demos: demo-magic
-
autojump
is a simple terminal tool to never ever rightcd <somewhere>
again -
Whene working in an CI environment such as Gitlab's CI/CD or Github Actions, one usually needs to access the predefined environment variables. Those are usually prefixed with unchanged characters such as
CI_
. But some tools (such ascypress
) require an other prefix to autoload variable such as those. To overcome this issue, a little shell script such as the following shoud suffice:$ function prefix_variables() { while IFS= read -r v; do export "$2_${v}=$(printf '%s\n' ${!v})"; done < <(compgen -A variable | grep "^$1_"); } $ export PREFIX_VAR="value" $ prefix_variables "PREFIX" "PRE" $ echo ${PRE_PREFIX_VAR} value
-
Output a test coverage report easily :
$ go test -coverprofile=/tmp/coverage.out $ go tool cover -html=/tmp/coverage.out -o /tmp/coverage.html $ <YOUR FAVORITE BROWSER> /tmp/coverage.html &
-
Upgrade or downgrade easily Golang with minimal system intrusions using update-golang.sh ;
-
Manage different versions of Golang with
gvm
; -
Manage your development workflow with Go in a Makefile way with mage. This tool can be augmented with mage-select for easier usage;
- Node Version Manager : POSIX-compliant bash script to manage multiple active
node.js
&npm
versions ;
- Beautiful UI components framework:
cube-ui
- virtualenvwrapper is a set of extensions to virtualenv tool. The extensions include wrappers for creating and deleting virtual environments and otherwise managing your development workflow ;
-
My git configuration ;
-
To have a global
.gitignore
file accross the environment, create a.gitignore
in your home directory, and run:$ git config --global core.excludesfile ~/.gitignore
This will create the following entry in your
.gitconfig
:[core] excludesfile = {path-to-home}/.gitignore
-
A command line tool to interact with a Gitlab repository, making it simple to clone, fork, including seamless workflow for creating merge requests, issues and snippets: lab ;
-
My
lab
aliases and helper functions ; -
A command line tool to interact with a Github repository:
hub
-
A nice plugin to bash providing contextual git information : bash-git-prompt ;
-
Git autocompletion for bash ;
gotham
is a flexible web framework that promotes stability, safety, security and speed. The documentation is full of almost ready-to-use examples which make it a very user-friendly framework ;
- Use
quicktype
to convert JSON into gorgeous, type-safe code in any language ;
- Repeatable and understandable builds with Earthly that merges makefiles & dockerfiles ;
-
Use Cloud SQL with the google proxy side container: In order to proxify a cloudSQL POSTGRES instance in a sideContainer, you will need a service account with one of this roles :
- Cloud SQL > Cloud SQL Client
- Cloud SQL > Cloud SQL Editor
- Cloud SQL > Cloud SQL Admin
Once this service account is created, you will need a service-account key to be available locally. To generate one, go to the IAM page of this service account (GCP console > IAM & admin > Service accounts), generate one and download it.
Retrieve the Instance Connection Name field:
- Go to GCP console > SQL
- Select the instance you want to access to
- In the
Overview
tab, theInstance Connection Name
field is under theConnect to this instance
section.
Open a terminal and define the following variables:
- DIR_PATH_CREDENTIALS: local path to the directory containing the credentials you just generated and downloaded
- INSTANCE_NAME: the instance connection name you just found in the GCP console
- CREDENTIALS: name of the credentials file For example:
$ export DIR_PATH_CREDENTIALS=/home/you/Downloads $ export INSTANCE_NAME=my-awesome-project:europe-west1:database-instance-id $ export CREDENTIALS=service-account-credentials.json
Start the cloud SQL proxy container:
$ docker run -p 127.0.0.1:5432:5432 --name cloud-sql-proxy -v ${DIR_PATH_CREDENTIALS}:/opt b.gcr.io/cloudsql-docker/gce-proxy /cloud_sql_proxy -instances=${INSTANCE_NAME}=tcp:0.0.0.0:5432 -credential_file=/opt/${CREDENTIALS}
-
Telepresence: Just follow the script given on https://www.telepresence.io/reference/install
curl -s https://packagecloud.io/install/repositories/datawireio/telepresence/script.deb.sh | sudo bash sudo apt install --no-install-recommends telepresence
Telepresence is using the kubectl commands so you just have to connect to your cluster using the command line given in the google cloud platform console. Since we enabled the k8s network policies, we need to deploy the telepresence node we will later connect to by applying the following file: telepresence.yaml
kubectl apply -f /tmp/telepresence.yaml
Then you just have to type Telepresence in your console: all the cluster IPs are proxyfied automatically.
telepresence --deployment telepresence --run-shell --also-proxy SOME.IP.TO.PROXYFY
The swap deployment is useful as it replace the current deployment by your local environment. So you are able to debug the code being edited in goland. In order to do the replacement, telepresence sets the replicaset to 0 in your cluster. The following command is used to replace the format-worker deployment:
telepresence --also-proxy 192.168.1.249 --also-proxy 192.168.1.250 --swap-deployment format-worker
In the case of an non-worker pod, you must add --expose 8080 to bind the port in the cluster
-
Switch faster between clusters and namespaces in kubectl with kubectx.
-
K9s provides a curses based terminal UI to interact with your Kubernetes clusters. The aim of this project is to make it easier to navigate, observe and manage your applications in the wild. K9s continually watches Kubernetes for changes and offers subsequent commands to interact with observed Kubernetes resources.
-
kind
is a very useful tool for running local Kubernetes clusters using Docker container "nodes". -
Kubernetes YAML Generator is a helper tool to define manifests. It provides meaningful explanations for each section of the resource and fillable forms to build your
YAML
file.
-
Node swagger-ui-watcher with hot reload feature to serve a rendered swagger HTML ;
-
Convert OpenAPI definitions into
json
schemas for all types in the API with openapi2jsonschema ; -
Render very nice customizable swaggers in
HTML
with redoc ;
-
Antora is a multi-repository documentation site generator for tech writers who love writing in AsciiDoc ;
-
Create and share beautiful images of your source code with carbon ;
-
Record and share terminal sessions the right way with asciinema ;
-
Vimium for Chrome or Firefox to browse the web with your keyboard ;
-
JSON Viewer awesome for Chrome only to visualize and json files in a very nice way ;
-
My i3 configurations:
-
If using Jetbrains products such as Goland, or Idea, and upgrading them with Jetbrains Toolbox, the executables are not accessible directly in the path. To make a dynamic link to the latest downloaded Pycharm (for example) version, proceed as follows:
$ su $ cat << EOF > /usr/local/bin/pycharm #!/bin/sh exec $(ls -t -d $HOME/.local/share/JetBrains/Toolbox/apps/PyCharm-P/ch-*/*/ | grep -v ".plugins" | head -n 1)bin/pycharm.sh EOF $ exit
-
To install easily AUR packages on an Archlinux/Manjaro OS, one can use
pacaur
, which mimicspacman
with AUR packages.
-
Bitwarden is an opensource authentication management solution to help handle passwords, keys, sensitive data etc... It comes handy with a nice CLI for terminal interaction with the vault.
-
balenaEtcher
is a very simple tool to flash USB keys into bootable drives -
To share files via P2P on a local network, one should use ShareDrop
-
Simplest terminal-friendly programming cheat sheet ever invented: cheat.sh
Used with curl as such :
$ curl cheat.sh/<TOPIC>/<QUERY>
Example:
$ curl cheat.sh/go/python+use+environment+variable