Skip to content

Instantly share code, notes, and snippets.

View mohitt's full-sized avatar
🎯
Focusing

Mohit Thakral mohitt

🎯
Focusing
View GitHub Profile
# Following throws exception with sessionmaker and asyncpg connection string
inspector = inspect(engine)
return inspector.has_table(table_name, schema_name)
@mohitt
mohitt / gist:da9cc416fe43baf0d7f8305b8c4b3447
Created January 23, 2022 01:42
Exception in sql alchemy
# Session created using session maker, asyncpg connection string
engine = self.active_session.get_bind()
table_name = model_class.__tablename__
schema_name = model_class.__table_args__["schema"]
return await engine.dialect.has_table(
self.active_session, table_name, schema_name
)
@mohitt
mohitt / .zshrc
Created October 9, 2021 05:56
zsh history configuration
export HISTFILE=~/.zsh_history
export HISTFILESIZE=1000000000
export HISTSIZE=1000000000
setopt INC_APPEND_HISTORY
export HISTTIMEFORMAT="[%F %T] "
setopt EXTENDED_HISTORY
setopt HIST_FIND_NO_DUPS
setopt HIST_IGNORE_ALL_DUPS
@mohitt
mohitt / ideavimrc
Created October 29, 2020 01:50
TempFile
let mapleader=" "
nnoremap <Leader>ve :e ~/.ideavimrc<CR>
nnoremap <Leader>vl :source ~/.ideavimrc<CR>
@mohitt
mohitt / HomeKeysOnMac.md
Created July 11, 2020 16:47
Home keys mapping mac

https://damieng.com/blog/2015/04/24/make-home-end-keys-behave-like-windows-on-mac-os-x

If, like me, you want Home to send you to the start of the line and not to the top of the document then create a file called DefaultKeyBinding.dict in your ~/Library/KeyBindings folder (might need to create that folder too) with the following contents:

{
  "\UF729"  = moveToBeginningOfParagraph:; // home
  "\UF72B"  = moveToEndOfParagraph:; // end
 "$\UF729" = moveToBeginningOfParagraphAndModifySelection:; // shift-home
https://codesandbox.io/s/4lr7oxxrl7?file=/src/Hello.js:311-321
@mohitt
mohitt / setup-windows.ps1
Created February 25, 2020 21:14
Setting up windows
choco install -y vsvim
choco install -y resharper
choco install -y vscode
choco install -y jetbrains-resharper
choco install -y golang
# restart terminal
go get github.com/pcarrier/gauth
# get the gauth.csv file from .config folder to copy paste
choco install -y microsoft-windows-terminal
@mohitt
mohitt / _vsvimrc-resharper
Last active February 14, 2020 03:06
_vsvimrc_resharper
let mapleader="\<space>"
set clipboard=unnamed
nnoremap <leader>j :vsc Window.PreviousTab<CR>
nnoremap <leader>k :vsc Window.NextTab<CR>
nnoremap <leader>r :vsc Resharper.Resharper_GotoRecentFiles<CR>
nnoremap <leader>e :vsc Resharper.Resharper_GotoType<CR>
nnoremap <leader>f :vsc Resharper.Resharper_GotoFile<CR>
nnoremap <leader>d :vsc File.Close<CR>
@mohitt
mohitt / command.pwsh
Created January 8, 2020 21:51
Get process id for port
Get-Process -Id (Get-NetTCPConnection -LocalPort 5050).OwningProcess
@mohitt
mohitt / idea vim
Created December 17, 2019 20:40
ideavim
let mapleader=" "
nnoremap <Leader>ve :e c:\users\mohit.thakral\.ideavimrc<CR>
nnoremap <Leader>vl :source c:\users\mohit.thakral\.ideavimrc<CR>
set clipboard=unnamedplus,unnamed
set nu
set rnu
set is
"
nmap <Leader>f :action GotoFile<CR>
nmap <Leader>s :action FileStructurePopup<CR>