Skip to content

Instantly share code, notes, and snippets.

View thwaller's full-sized avatar
🏠
Working from space

thwaller thwaller

🏠
Working from space
View GitHub Profile
@thwaller
thwaller / combining-git-repositories.md
Created November 6, 2021 02:16 — forked from msrose/combining-git-repositories.md
How to combine two git repositories.

Combining two git repositories

Use case: You have repository A with remote location rA, and repository B (which may or may not have remote location rB). You want to do one of two things:

  • preserve all commits of both repositories, but replace everything from A with the contents of B, and use rA as your remote location
  • actually combine the two repositories, as if they are two branches that you want to merge, using rA as the remote location

NB: Check out git subtree/git submodule and this Stack Overflow question before going through the steps below. This gist is just a record of how I solved this problem on my own one day.

Before starting, make sure your local and remote repositories are up-to-date with all changes you need. The following steps use the general idea of changing the remote origin and renaming the local master branch of one of the repos in order to combine the two master branches.

@thwaller
thwaller / keyboard-keys.md
Created November 1, 2021 12:48 — forked from bittner/keyboard-keys.md
Keyboard keys markup in MarkDown

Ctrl + Alt + Space

@thwaller
thwaller / disabel_dpm.txt
Created October 27, 2021 05:26 — forked from SinSquare/disabel_dpm.txt
Fedora amdgpu disable DPM
https://bugzilla.redhat.com/show_bug.cgi?id=1478219
1) download radcard script:
https://raw.githubusercontent.com/superjamie/snippets/master/radcard
2) chmod +x radcard
3) sudo cp radcard /usr/local/bin/radcard
@thwaller
thwaller / package_updates_check.py
Created September 4, 2021 07:38 — forked from yumminhuang/package_updates_check.py
Python script to check apt-get updates
#!/usr/bin/env python
#coding=utf-8
import apt
import apt_pkg
from time import strftime
import os
import subprocess
import sys
@thwaller
thwaller / upgrade.sh
Created September 4, 2021 07:34 — forked from bocharsky-bw/upgrade.sh
Shell Script for Upgrade Ubuntu via APT in one step
#!/bin/bash
TEXT_RESET='\e[0m'
TEXT_YELLOW='\e[0;33m'
TEXT_RED_B='\e[1;31m'
sudo apt-get update
echo -e $TEXT_YELLOW
echo 'APT update finished...'
echo -e $TEXT_RESET
@thwaller
thwaller / BackupRestoreMySQLDatabase.md
Created July 21, 2021 09:45 — forked from chathudan/BackupRestoreMySQLDatabase.md
Back Up and Restore a MySQL Database

If you're storing anything in MySQL databases that you do not want to lose, it is very important to make regular backups of your data to protect it from loss. This tutorial will show you two easy ways to backup and restore the data in your MySQL database. You can also use this process to move your data to a new web server.

Back up From the Command Line (using mysqldump)

Back up your MySQL Database with Compress

Restoring your MySQL Database

Backing Up and Restoring using PHPMyAdmin

@thwaller
thwaller / mysql_backup_restore.sh
Created July 21, 2021 09:42 — forked from abhiomkar/mysql_backup_restore.sh
MySQL Backup/Restore Script
# Backup using MySQL Dump
mysqldump --user=root --password=very_strong_password --database mydb > ~/backups/mydb_backup_$(date '+%F_%H%M%S').sql
# Restore
mysql --verbose --user=root --password=very_strong_password mydb < ~/backups/mydb_backup_2011-06-15_085322.sql
@thwaller
thwaller / backup-db-to-git.sh
Created July 21, 2021 09:41 — forked from bonesoul/backup-db-to-git.sh
MySQL Database to Git Backup Script
#!/bin/sh
cd /var/www/YOURSITE.ORG
date=`date +"%b-%d-%y-%H-%M-%S"`
mysqldump -h SERVER_IP -u root -pPASSWORD --skip-extended-insert --skip-dump-date --databases DBNAME > db-backups/YOURSITE.ORG.sql
git add -A
git commit -m "Site backups for $date"
git push
git gc
#!/usr/local/bin/bash
db=$1
pwd='pwd'
backupdate=`date`
backupPath='/var/backups/mysql/data/'
dumplog="/var/log/mysqlbackup.log"
errorlog="/tmp/mysqlbackup-error.log"
@thwaller
thwaller / db_backup.sh
Created July 21, 2021 09:41 — forked from lon-io/db_backup.sh
MySQL backup shell script
#!/bin/bash
# Shell script to backup MySQL database
# Set these variables
MyUSER="" # DB_USERNAME
MyPASS="" # DB_PASSWORD
MyHOST="" # DB_HOSTNAME
# Backup Dest directory
DEST="" # /home/username/backups/DB