Skip to content

Instantly share code, notes, and snippets.

View salehahr's full-sized avatar
🌘
EOL

salehahr

🌘
EOL
View GitHub Profile
@salehahr
salehahr / gitk
Created March 24, 2024 18:46
gitk
set mainfont {{Gill Sans MT} 12}
set textfont {{JetBrains Mono} 11 bold}
set uifont {{Gill Sans MT} 11}
set tabstop 8
set findmergefiles 0
set maxgraphpct 50
set maxwidth 16
set cmitmode patch
set wrapcomment none
set autoselect 1
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@salehahr
salehahr / math.snippets
Created August 4, 2021 18:02
math snippets
global !p
texMathZones = ['texMathZone' + x for x in ['A', 'AS', 'B', 'BS', 'C',
'CS', 'D', 'DS', 'E', 'ES', 'F', 'FS', 'G', 'GS', 'H', 'HS', 'I', 'IS',
'J', 'JS', 'K', 'KS', 'L', 'LS', 'DS', 'V', 'W', 'X', 'Y', 'Z',
'AmsA', 'AmsB', 'AmsC',
'AmsD', 'AmsE', 'AmsF', 'AmsG', 'AmsAS', 'AmsBS',
'AmsCS', 'AmsDS', 'AmsES',
'AmsFS', 'AmsGS']]
texIgnoreMathZones = ['texMathText']

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@salehahr
salehahr / core_dumps
Created February 23, 2021 13:59
Get core dumps for debugging
# Source: https://jvns.ca/blog/2018/04/28/debugging-a-segfault-on-linux/
ulimit -c unlimited
sudo sysctl -w kernel.core_pattern=/tmp/core-%e.%p.%h.%t
gdb -c my_core_file
# In gdb
symbol-file /path/to/my/binary
sharedlibrary
@salehahr
salehahr / .vimrc
Last active September 29, 2021 12:25
.vimrc
cmap w!! %!sudo tee > /dev/null
"""""""""""""""""""""""""""""" GENERAL """"""""""""""""""""""""""""""
" Set line numbering and text wrapping
set nocompatible
set nu!
set wrap!
set tabstop=4
set shiftwidth=4
set expandtab
@salehahr
salehahr / .bashrc
Last active November 13, 2021 06:55
WSL setup for SOFA, thesis, coding
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0
export LIBGL_ALWAYS_INDIRECT=0
export PATH="~/.local/bin:~/cmake/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
export PATH="$PATH:~/sofa/build2/install/bin"
export PATH="$PATH:/mnt/c/Program Files/Notepad++"
export SOFA_ROOT="~/sofa/build2/install"
alias sudo='sudo '
alias npp='notepad++.exe'
@salehahr
salehahr / delete_git_submodule.md
Created September 6, 2020 06:47 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule