Skip to content

Instantly share code, notes, and snippets.

View thefrench77's full-sized avatar

French 77 thefrench77

  • Texas
View GitHub Profile
@thefrench77
thefrench77 / gist:92bc00c363ddb487ee106913e1a6b47d
Created April 4, 2018 21:49
Get rid of modified files that are actually not modified
git rm .gitattributes
git add -A
git reset --hard
{
"plugins": [ "git", "hg", "ssh", "z", "aliases", "dircolors" ],
"dircolors": {
"dirs": [
[".*", "cyan", ""]
],
"files": [
["(?ix).(7z|zip|tar|gz|rar)$", "darkcyan", ""],
["(?ix).(exe|bat|cmd|py|pl|ps1|psm1|vbs|rb|reg)$", "darkgreen", ""],
["(?ix).(doc|docx|ppt|pptx|xls|xlsx|mdb|mdf|ldf)$", "magenta", ""],
@thefrench77
thefrench77 / OpenWithSublimeText3.bat
Created January 23, 2017 19:40 — forked from mahmoud-samy-old/OpenWithSublimeText3.bat
Add “Open with Sublime Text 3″ to Windows Explorer Context Menu
@echo off
SET st2Path=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st2Path% "%%1"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
Interrupted workflow
Suppose you are interrupted by an urgent fix request while you are in the middle of a large change. The files in your working tree are not in any shape to be committed yet, but you need to get to the other branch for a quick bugfix.
$ git checkout feature ;# you were working in "feature" branch and
$ work work work ;# got interrupted
$ git commit -a -m "snapshot WIP" (1)
$ git checkout master
$ fix fix fix
$ git commit ;# commit with real log
$ git checkout feature
@thefrench77
thefrench77 / atoi.c
Created October 19, 2016 13:24
ASCII to integer
int atoi(char const *c)
{
int r = 0;
while (*c != '\0') {
r = r * 10 + (*c - '\0');
c++;
}
return r;
}
@thefrench77
thefrench77 / Default (Windows).sublime-mousemap
Created March 3, 2016 20:50
Visual Studio-like mouse controls for Sublime Text 3
[
// Ctrl-click word select
{
"button": "button1", "count": 1, "modifiers": ["ctrl"],
"press_command": "drag_select",
"press_args": {"by": "words"}
},
// Alt-click column select
{
"button": "button1",
@thefrench77
thefrench77 / adb_density.sh
Last active February 26, 2016 23:58
Change Android LCD density
#!/usr/bin/zsh
adb shell wm density "$@" && adb reboot
@thefrench77
thefrench77 / adb_displayinfo.sh
Last active April 26, 2018 19:27
Dump Android display info
#!/usr/bin/zsh
adb shell dumpsys display | grep mBaseDisplayInfo
@thefrench77
thefrench77 / Preferences.sublime-settings
Created February 26, 2016 17:03
Sublime Text 3 Preferences [W64]
{
"always_prompt_for_file_reload": false,
"always_show_minimap_viewport": false,
"animation_enabled": true,
"atomic_save": false,
"auto_close_tags": true,
"auto_complete": false,
"auto_complete_commit_on_tab": false,
"auto_complete_cycle": false,
"auto_complete_delay": 50,
@thefrench77
thefrench77 / profile.ps1
Created February 18, 2016 18:27
PowerShell profile
$env:Path = ".;$env:Path"
# Window title:
$host.ui.RawUI.WindowTitle=[Environment]::UserDomainName + "\" + [Environment]::UserName + "@" + [Environment]::MachineName
# Persistent history:
$HistoryFilePath = Join-Path ([Environment]::GetFolderPath('UserProfile')) .ps_history
Register-EngineEvent PowerShell.Exiting -Action { Get-History | Export-Clixml $HistoryFilePath } | out-null
if (Test-path $HistoryFilePath) { Import-Clixml $HistoryFilePath | Add-History }
Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward