Skip to content

Instantly share code, notes, and snippets.

View amontalban's full-sized avatar

Andres Montalban amontalban

View GitHub Profile
@SpekkoRice
SpekkoRice / checkiftablexists
Created March 5, 2015 12:37
BASH: Check if MySQL Table exists
#!/bin/bash
checkIfMySQLTableExists() {
table=$1;
if [ $(mysql -N -s -u root -p -e \
"select count(*) from information_schema.tables where \
table_schema='${table}' and table_name='${DB}';") -eq 1 ]; then
echo "Table ${table} exists! ...";
else
echo "Table ${table} does not exist! ..."
@KartikTalwar
KartikTalwar / Documentation.md
Last active April 13, 2024 23:09
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
@tathamoddie
tathamoddie / RequiresPowerShell.bat
Created August 5, 2010 03:48
Batch file to automatically detect, download and install PowerShell 2 on to an XP SP3 machine
@echo off
REM If PowerShell 2 is not installed, this script will automatically download and install it.
REM Only works on XP SP3 with .NET 3.5. Only for dev boxes, not designed for servers.
REM Based on http://blog.codeassassin.com/2009/12/10/no-web-browser-need-powershell/
ver | find "XP" > nul
if %ERRORLEVEL% neq 0 goto not_xp
ver | find "5.1.2600" > nul