Skip to content

Instantly share code, notes, and snippets.

View X0nic's full-sized avatar

Nathan Lee X0nic

View GitHub Profile
@X0nic
X0nic / ssh.sh
Last active December 14, 2015 08:28
handy ssh
#!/bin/bash
# dump restore in one command
ssh -C {ssh.user}@{remote_host} mysqldump -u {remote_dbuser} --password={remote_dbpassword} \
{remote_dbname} | mysql -u {local_dbuser} --password={local_dbpassword} -D {local_dbname}
# grab a backup zip
ssh -C {ssh.user}@{remote_host} mysqldump -u {remote_dbuser} --password={remote_dbpassword} \
{remote_dbname} | gzip > {dbname}.sql.gz
@X0nic
X0nic / time-shift.sh
Last active December 12, 2015 09:59
Time shifting
#you will most likely need to sudo these commands
#add 14 days
date -s "14 day"
#subtract 14 days
date -s "-14 day"
#set date to something specific
date -s "02/28/2013 08:24:14"
@X0nic
X0nic / gits.sh
Last active December 12, 2015 07:09
Handy Git Commands
#remove old git remote branches
git remote prune origin --dry-run
git remote prune origin
#fancy git log
git log --graph --pretty=format:'%Cred%h%Creset %C(yellow)%an%d%Creset %s %Cgreen(%cr)%Creset' --date=relative
#alias, put in ~/.gitconfig
#[alias]
# lg = log --graph --pretty=format:'%Cred%h%Creset %C(yellow)%an%d%Creset %s %Cgreen(%cr)%Creset' --date=relative
@X0nic
X0nic / disable-vagrant-time-sync.sh
Last active February 4, 2022 04:52
Disable vagrant time sync
#List vms
VBoxManage list vms
#get status of time sync
VBoxManage getextradata <vm-name> VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled
#NOTE: Make sure to restart the VM after changing these settings.
#disable time sync
VBoxManage setextradata <vm-name> VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled 1
(define (square x)
(* x x))
> (square 3)
9
> (sin 2)
#i0.9092974268256817
> (max 1 2)
2