Skip to content

Instantly share code, notes, and snippets.

View sheeeng's full-sized avatar
🐚
It's Friday! ヽ(♡‿♡)ノ

Leonard Sheng Sheng Lee sheeeng

🐚
It's Friday! ヽ(♡‿♡)ノ
View GitHub Profile
@sheeeng
sheeeng / README.md
Last active April 29, 2024 09:19 — forked from duboisf/README.md
Example GitHub graphql queries using the gh cli

List all the default branches of repositories in a specific organisation

gh api graphql --paginate \
    --jq '.data.organization.repositories.nodes[] | .defaultBranchRef.name + "\t" + .name' \
    -F org=SomeOrg \
    -f query='
query($org:String!, $endCursor:String) { 
  organization(login:$org) {
    repositories(first: 100, after: $endCursor, isFork:false, orderBy: {field:NAME, direction:ASC}) {

The following icon sets are bundled with Material for MkDocs:

  • :material-material-design: – [Material Design] ( :material-account-credit-card: :material-bank: :material-cash-register: :material-safe: :material-github: :material-kubernetes: :material-microsoft-azure: )

  • :fontawesome-brands-font-awesome: – [FontAwesome] ( :fontawesome-brands-slack: :fontawesome-brands-microsoft: :fontawesome-brands-windows: :fontawesome-brands-markdown: :fontawesome-brands-python: :fontawesome-brands-golang: :fontawesome-brands-rust: )

  • :octicons-mark-github-16: – [Octicons] ( :octicons-git-branch-24: :octicons-git-commit-24: :octicons-git-compare-24: :octicons-git-merge-24: :octicons-git-merge-queue-24: :octicons-git-pull-request-24: :octicons-git-pull-request-closed-24: :octicons-git-pull-request-draft-24: )

  • :simple-simpleicons: – [Simple Icons] ( :simple-kubernetes: :simple-github: :simple-githubpages: :simple-githubactions: )

    [Materia

@sheeeng
sheeeng / gist:94b1bf746d96b58a84ec9f8d6bfefcd6
Created December 18, 2023 12:28 — forked from andreibosco/gist:cb8506780d0942a712fc
Using GNU Stow to manage your dotfiles

Fonte: http://brandon.invergo.net/news/2012-05-26-using-gnu-stow-to-manage-your-dotfiles.html?round=two

I accidentally stumbled upon something yesterday that I felt like sharing, which fell squarely into the "why the hell didn't I know about this before?" category. In this post, I'll describe how to manage the various configuration files in your GNU/Linux home directory (aka "dotfiles" like .bashrc) using GNU Stow.

The difficulty is that it would be helpful to manage one's configuration files with a version control system like Git, Mercurial or Bazaar, but many/most dotfiles reside at the top-level of your home directory, where it wouldn't be a good idea to initialize a VCS repository. Over time I've come across various programs which aim to manage this for you by keeping all the files in a subdirectory and then installing or linking them into their appropriate places. None of those programs ever really appealed to me. They would require a ton of dependencies (like Ruby and a ton of libraries for it) or t

@sheeeng
sheeeng / README.md
Last active January 27, 2024 19:33 — forked from GusAntoniassi/README.md
Configure autocompletion to kubectl with zsh

kubectl with ZSH (oh-my-zsh)

How to configure

Use the following commands to add the kubectl autocomplete to zsh:

mkdir -p ~/.oh-my-zsh/custom/plugins/kubectl-autocomplete/
kubectl completion zsh > ~/.oh-my-zsh/custom/plugins/kubectl-autocomplete/kubectl-autocomplete.plugin.zsh
@sheeeng
sheeeng / spabs.md
Created December 15, 2023 09:51 — forked from eevee/spabs.md
tabs to spaces
@sheeeng
sheeeng / homebrew-gnubin.md
Created December 11, 2023 19:06 — forked from skyzyx/homebrew-gnubin.md
Using GNU command line tools in macOS instead of FreeBSD tools

macOS is a Unix, and not built on Linux.

I think most of us realize that macOS isn't a Linux OS, but what that also means is that instead of shipping with the GNU flavor of command line tools, it ships with the FreeBSD flavor. As such, writing shell scripts which can work across both platforms can sometimes be challenging.

Homebrew

Homebrew can be used to install the GNU versions of tools onto your Mac, but they are all prefixed with "g" by default.

All commands have been installed with the prefix "g". If you need to use these commands with their normal names, you can add a "gnubin" directory to your PATH from your bashrc.

@sheeeng
sheeeng / example.sh
Last active November 13, 2023 11:30
Bash script example template.
#!/usr/bin/env bash
# https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
set -o pipefail
set -o errexit # set -e
set -o nounset # set -u
set -o xtrace # set -x
# https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html
shopt -s inherit_errexit
import "regexp"
// Basic regular expressions for validating strings
const (
Email string = "^(((([a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])+(\\.([a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(([a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])([a-zA-Z]|\\d|-|\\.|_|~|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])*([a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])))\\.)+(([a-zA-Z]|[\\
@sheeeng
sheeeng / expandUrl.sh
Created October 30, 2023 13:35
Free AWS SkillBuilder digital badges!
expandUrl() { wget --server-response $1 2>&1 | grep "^Location"; }