Skip to content

Instantly share code, notes, and snippets.

View mohitt's full-sized avatar
🎯
Focusing

Mohit Thakral mohitt

🎯
Focusing
View GitHub Profile
# This is with git v1.9.4, make sure to put "C:\Program Files\Perforce" in path
git config --global merge.tool p4merge
git config --global diff.tool p4merge
git config --global --add difftool.prompt false
git config --global --add mergetool.prompt false
@mohitt
mohitt / Robocopy
Last active August 29, 2015 14:15
RoboCopyBackup
Robocopy M:\ D:\M-Drive /E /z /256 /move /r:3 /w:5 /v /eta /fp /log+:C:\M-driveCopyLog.log
Robocopy C:\ D:\C-Drive /E /z /256 /move /r:1 /w:1 /v /eta /fp /log+:M:\C-driveCopyLog.log /xa:S /XD "C:\Program Files" "C:\Windows" "C:\Documents and Settings" "C:\Program Files (x86)" "C:\ProgramData" "C:\Intel" "C:\logs" "C:\MSOCache" "C:\Nuget" "C:\cygwin64" "C:\Users\mohit_thakral\AppData"
Robocopy C:\Users\mohit_thakral D:\C-Drive\Users\mohit_thakral /E /z /256 /move /r:1 /w:1 /v /eta /fp /log+:M:\C-driveCopyLog.log /xa:S /XD "C:\Program Files" "C:\Windows" "C:\Documents and Settings" "C:\Program Files (x86)" "C:\ProgramData" "C:\Intel" "C:\logs" "C:\MSOCache" "C:\Nuget" "C:\cygwin64" "C:\Users\mohit_thakral\AppData"
@mohitt
mohitt / Powershell PSGet Install Proxy
Created February 25, 2015 22:11
Powershell PSGet Install Proxy
$c = (new-object Net.WebClient) ; $p = [System.Net.WebRequest]::GetSystemWebProxy(); $p.Credentials = [System.Net.CredentialCache]::DefaultCredentials; $c.proxy = $p ; $c.DownloadString("http://psget.net/GetPsGet.ps1") | iex
@mohitt
mohitt / Choco Installs
Created February 25, 2015 22:23
Choco Installs
choco install windowsazurepowershell -y
choco install nodejs -y
* %userprofile%\.babun\cygwin\bin\mintty.exe -
>*"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" "-cur_console:a:t:PS"
*%systemroot%\SysWOW64\cmd.exe /c ""%SystemDrive%\cygwin64\bin\sh.exe" --login -i" "-cur_console:t:Cygwin Bash"
@mohitt
mohitt / powershell
Created June 29, 2015 18:59
git diff modified files to the older version
git status --porcelain | % { $_.split(" ")[2] } | % { git difftool 5069d42 $_}
@mohitt
mohitt / .gitconfig
Created July 8, 2015 21:07
Single Files
[user]
email = me@mohitt.com
name = Mohit Thakral
[credential]
[filter "lfs"]
clean = git lfs clean %f
smudge = git lfs smudge %f
required = true
[credential]
helper = wincred
@mohitt
mohitt / create_mysql_db
Last active December 15, 2015 12:28
Create a Mysql db with user and grant permissions, replace ##DBNAME## with database name and ##DBUSER## with username and ##DBPASSWORD## with new user password
CREATE DATABASE IF NOT EXISTS ##DBNAME##;
GRANT ALL on ##DBNAME##.* to '##DBUSER##'@'%' identified by '##DBPASSWORD##';
GRANT ALL on ##DBNAME##.* to '##DBUSER##'@'localhost' identified by '##DBPASSWORD##';
USE ##DBNAME##;
@mohitt
mohitt / RoboCopy
Last active January 1, 2016 01:32
Robocopy
Robocopy C:\Users\mohit_thakral\ \\Desktop-da2t7v9\c\LaptopBackup\C-Drive\Users\mohit_thakral\ /MT:100000 /sl /xjd /xa:s /e /eta /tee /fp /a-:hs /b /MIR /R:0 /Z /XF *.iso *.log *.au C:\Users\mohit_thakral\NTUSER.DAT "C:\Users\mohit_thakral\Documents\Outlook Files\LocalEmails - Copy.pst" /LOG:M:\C-drive-backup4.log /XD C:\Users\mohit_thakral\AppData .android .AndroidStudio1.2 .babun C:\Users\mohit_thakral\Dropbox C:\Users\mohit_thakral\OneDrive
robocopy /b /e /xa:s /xjd /sl /a-:hs /mt /v /fp /eta /log:"D:\To\Directory\transfer.log" /tee "C:\From\Directory" "D:\To\Directory"
(Note that the paths don't have a trailing backslash.)
/b -- backup mode (there's a /zb option for restart mode, but it's a whole lot slower)
/e -- copies subdirectories (including empty directories) in addition to files
git clone <original-remote>
cd <directory>
git remote add gitlab <gitlab-url>
for remote in `git branch -r`; do git branch --track ${remote/origin\//}; done
git push --all gitlab