Skip to content

Instantly share code, notes, and snippets.

View ted-vo's full-sized avatar
🎯
Focusing

Ted Võ ted-vo

🎯
Focusing
View GitHub Profile
@ted-vo
ted-vo / git-reset-author.sh
Created November 21, 2024 06:57 — forked from bgromov/git-reset-author.sh
Git: reset author for ALL commits
#!/bin/sh
# Credits: http://stackoverflow.com/a/750191
git filter-branch -f --env-filter "
GIT_AUTHOR_NAME='Newname'
GIT_AUTHOR_EMAIL='new@email'
GIT_COMMITTER_NAME='Newname'
GIT_COMMITTER_EMAIL='new@email'
" HEAD
@ted-vo
ted-vo / git-clearHistory
Created January 13, 2024 03:28 — forked from stephenhardy/git-clearHistory
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git
@ted-vo
ted-vo / remove_gitlab_artifacts.sh
Created December 26, 2023 04:48 — forked from carceneaux/remove_gitlab_artifacts.sh
Script for removing GitLab Job Artifacts.
#!/bin/bash
#
# Written by Chris Arceneaux
# GitHub: https://github.com/carceneaux
# Email: carcenea@gmail.com
# Website: http://arsano.ninja
#
# Note: This code is a stop-gap to erase Job Artifacts for a project. I HIGHLY recommend you leverage
# "artifacts:expire_in" in your .gitlab-ci.yml
#
@ted-vo
ted-vo / bash_strict_mode.md
Created June 15, 2022 05:56 — forked from vncsna/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation

set -e, -u, -o, -x pipefail

The set lines

  • These lines deliberately cause your script to fail. Wait, what? Believe me, this is a good thing.
  • With these settings, certain common errors will cause the script to immediately fail, explicitly and loudly. Otherwise, you can get hidden bugs that are discovered only when they blow up in production.
  • set -euxo pipefail is short for:
set -e
set -u
@ted-vo
ted-vo / mongo_backup.sh
Created June 6, 2020 08:18 — forked from sheharyarn/mongo_backup.sh
Mongodump Shell Script for Cronjob
#!/bin/bash
MONGO_DATABASE="your_db_name"
APP_NAME="your_app_name"
MONGO_HOST="127.0.0.1"
MONGO_PORT="27017"
TIMESTAMP=`date +%F-%H%M`
MONGODUMP_PATH="/usr/bin/mongodump"
BACKUPS_DIR="/home/username/backups/$APP_NAME"
@ted-vo
ted-vo / Nginx Full
Last active June 16, 2019 07:05 — forked from hoangthienclub/Nginx Full
Nginx Full
server {
listen 80;
listen [::]:80;
server_name gitosolutions.com;
return 301 https://$server_name$request_uri;
}
upstream web_nodes {
least_conn;
server 10.130.74.103:5159;
@ted-vo
ted-vo / Utils.java
Created December 2, 2018 16:59 — forked from JosiasSena/Utils.java
Helpful utility class
package josiassena.humbug;
import android.Manifest;
import android.app.Activity;
import android.app.NotificationManager;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;