Skip to content

Instantly share code, notes, and snippets.

View iamcryptoki's full-sized avatar

Gael Gentil iamcryptoki

View GitHub Profile
@iamcryptoki
iamcryptoki / backup_gnome_settings.txt
Last active July 6, 2020 11:32
Backup Gnome settings.
# Install dconf
$ sudo dnf install dconf
# Backup settings
$ cd ~
$ dconf dump /org/gnome/ > gnome_settings.dconf
# Restore settings
$ cd ~
dconf load /org/gnome/ < gnome_settings.dconf
______ _______ __ __ _______ ________ ______ __ __ ______
/ \ | \| \ / \| \| \ / \ | \ / \| \
| $$$$$$\| $$$$$$$\\$$\ / $$| $$$$$$$\\$$$$$$$$| $$$$$$\| $$ / $$ \$$$$$$
| $$ \$$| $$__| $$ \$$\/ $$ | $$__/ $$ | $$ | $$ | $$| $$/ $$ | $$
| $$ | $$ $$ \$$ $$ | $$ $$ | $$ | $$ | $$| $$ $$ | $$
| $$ __ | $$$$$$$\ \$$$$ | $$$$$$$ | $$ | $$ | $$| $$$$$\ | $$
| $$__/ \| $$ | $$ | $$ | $$ | $$ | $$__/ $$| $$ \$$\ _| $$_
\$$ $$| $$ | $$ | $$ | $$ | $$ \$$ $$| $$ \$$\| $$ \
\$$$$$$ \$$ \$$ \$$ \$$ \$$ \$$$$$$ \$$ \$$ \$$$$$$
@iamcryptoki
iamcryptoki / cidr_subnet.txt
Last active August 6, 2020 09:28
CIDR subnet.
/32 255.255.255.255
/31 255.255.255.254
/30 255.255.255.252
/29 255.255.255.248
/28 255.255.255.240
/27 255.255.255.224
/26 255.255.255.192
/25 255.255.255.128
/24 255.255.255.0
/23 255.255.254.0
@iamcryptoki
iamcryptoki / migrate_git_repository.txt
Created October 6, 2020 10:33
Migrate Git repository with history and branches.
# Clone current repo.
$ git clone https://current.example.com/repo.git
$ git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
$ git fetch --all
$ git pull --all
# Change Git remote's URL.
$ git remote set-url origin https://new.example.com/repo.git
$ git push --all
@iamcryptoki
iamcryptoki / sbt_new.sh
Created November 3, 2020 15:29
Create an SBT project directory structure.
#!/bin/sh
mkdir -p src/{main,test}/{java,resources,scala}
mkdir lib project target
# build.sbt
echo 'name := "<YOUR_PROJECT_NAME>"
version := "1.0"
scalaVersion := "2.13.3"' > build.sbt
@iamcryptoki
iamcryptoki / fix_k8s_delete_crd_stuck.txt
Created December 4, 2020 10:57
Fix: Kubernetes CRD deleting stuck in Terminating state.
$ kubectl patch crd/<CRD_NAME_HERE> -p '{"metadata":{"finalizers":[]}}' --type=merge
@iamcryptoki
iamcryptoki / cert_expiration_date.txt
Created March 1, 2021 15:39
Get certificate expiration date.
$ echo | openssl s_client -servername example.com -connect example.com:443 2>/dev/null | openssl x509 -noout -dates
@iamcryptoki
iamcryptoki / curl_github_actions_workflow.txt
Created March 1, 2021 15:42
Run GitHub Actions Workflow using Curl (workflow_dispatch).
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token <ACCESS_TOKEN_HERE>" \
https://api.github.com/repos/<ORG_OR_USERNAME>/<REPO>/actions/workflows/<FILENAME_OR_WORKFLOW_ID>/dispatches \
-d '{"ref":"refs/heads/master"}'
@iamcryptoki
iamcryptoki / kubernetes_private_docker_image.txt
Created March 9, 2021 14:33
Access private Docker Hub repository from Kubernetes.
$ kubectl create secret docker-registry <SECRET_NAME> \
--docker-server=https://docker.io \
--docker-username=<DOCKER_USERNAME> \
--docker-password=<DOCKER_TOKEN> \
--docker-email=<DOCKER_EMAIL>
@iamcryptoki
iamcryptoki / google_cloud_storage_versioning.txt
Created March 11, 2021 07:25
Enable/Disable Google Cloud Storage Bucket versioning.
# Enable GCS versioning
$ gsutil versioning set on gs://<BUCKET_NAME>
# Disable GCS versioning
$ gsutil versioning set off gs://<BUCKET_NAME>