Skip to content

Instantly share code, notes, and snippets.

View tdnguyen6's full-sized avatar

T.D. Nguyen tdnguyen6

View GitHub Profile
@tdnguyen6
tdnguyen6 / BitWarden
Last active March 25, 2022 16:39
Custom kustomize plugins to get secrets values from bitwarden via templating
#!/usr/bin/env /usr/bin/python3
# Store this file at $HOME/.config/kustomize/plugins/tidunguyen/v1/bitwarden/BitWarden
import sys
import yaml
import subprocess
import re
import subprocess
from base64 import b64decode, b64encode
@tdnguyen6
tdnguyen6 / build-img
Last active December 28, 2021 15:45
Script to build OCI image inside another OCI image using kaniko
#!/usr/bin/env bash
pod_created=false
trap del-pod EXIT
help()
{
echo "Build image using kaniko and output a tarball representing the built image.
Tarball of built image can then be managed (show digest, push, etc.) using crane/gcrane.
@tdnguyen6
tdnguyen6 / blue-owl-custom.omp.json
Created September 26, 2021 13:55
My custom theme for oh my posh based on Blue Owl theme
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"final_space": false,
"osc99": true,
"console_title": true,
"console_title_style": "template",
"console_title_template": "{{if .Root}} ⚡ {{end}}{{.Folder | replace \"~\" \"🏚\" }} @ {{.Host}}",
"blocks": [
{
"type": "prompt",
@tdnguyen6
tdnguyen6 / clean_abandoned_pipenv.sh
Created August 7, 2021 10:52
Bash script to clean abandoned pipenv environments (non-existing project folder)
#!/usr/bin/env bash
# get all pipenv environments
allPipenvEnv=$(find ~/.local/share/virtualenvs/*/.project -type f)
# find abandoned environments
abandonedEnv=()
for f in $allPipenvEnv; do
proj_path="$(cat $f)" && [ ! -d $proj_path ] && abandonedEnv+=($proj_path)
done
@tdnguyen6
tdnguyen6 / solution.template.cpp
Last active October 28, 2020 16:47
C++ template for competitive programming
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#include <bits/stdc++.h>
using namespace std;
// using std::cout
// namespace chrono = std::chrono;
/******* All Required define Pre-Processors and typedef Constants *******/
#define watch(x) cout << (#x) << " is " << (x) << endl
@tdnguyen6
tdnguyen6 / .gitignore
Last active April 13, 2020 06:42
HW2 DBMS
# db binary
**/*.db
# archives
**/*.tar.gz
# long csv files
**/*.csv
# dump files
@tdnguyen6
tdnguyen6 / .gitignore
Last active March 20, 2020 14:14
HW1-Sqlite
# ignore binary database files
*.db