Skip to content

Instantly share code, notes, and snippets.

Avatar

Nitish Garg nitish6174

View GitHub Profile
View python_cron.py
from crontab import CronTab
from datetime import datetime
cron = CronTab()
cmds = {
'python ~/code/reminder.py': '0/30 9-18 * * *',
'~/code/backup.sh': '0/30 9-18 * * *',
}
for cmd, cron_str in cmds.items():
View bash_tools.md

Remove trailing whitespace from files

sed -i 's/[ \t]*$//' folder/*/*.py

Convert Jupyter notebook to PPT

jupyter nbconvert --to slides filename.ipynb
View code_profiling.md

PyInstrument

from pyinstrument import Profiler
profiler = Profiler()

profiler.start()

# --- code to profile : start ---
# e.g. :-
@nitish6174
nitish6174 / .vimrc
Last active Oct 8, 2016
Improve vim by installing vundle package manager, following plugins and using keyboard shortcuts
View .vimrc
" --------------------------------------------------
" Vundle package manager settings
" --------------------------------------------------
set nocompatible
filetype off
" ---------- Set path of vundle file ----------
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
@nitish6174
nitish6174 / ubuntu-gnome-extensions.md
Created Oct 4, 2016
List of useful Ubuntu Gnome extensions to install
View ubuntu-gnome-extensions.md
  • Alternatetab (Ungroup windows of same type)
  • Applications menu (Windows OS style Applications menu)
  • Caffeine (Disable autosuspend)
  • Clipboard indicator (Clipboard history)
  • Drop down terminal (Alternative to Guake terminal)
  • Easyscreencast (Screen recording)
  • Laine (Control volume of each application)
  • Media keys (Music control buttons on topbar)
  • Media player indicator (Music controller for topbar)
  • Pixel saver (Brings title bar applications to topbar)
@nitish6174
nitish6174 / ubuntu-gnome-themes.md
Last active Oct 4, 2016
List of dark themes for Ubuntu Gnome
View ubuntu-gnome-themes.md
  • Adapta
  • Arc
  • Flatabulous
  • Nebula
  • Numix
  • Paper
  • Super flat remix (Icon theme)
@nitish6174
nitish6174 / sublime_packages.md
Last active Oct 4, 2016
List of useful Sublime text packages
View sublime_packages.md
  • Manager and explorer :
    • Package manager : To manage all your sublime packages
    • SideBarEnhancements : Gives an extensive menu for renaming, duplicating file etc from the file explorer pane (The left column)
  • Themes & Color schemes :
    • Monokai Extended
    • Predawn
    • Theme - Afterglow
    • Theme - Asphalt
    • Theme - Brogrammer
    • Theme - Flatland
@nitish6174
nitish6174 / git_visualize.md
Last active Oct 10, 2016
Git alias for a better commit visualizaion
View git_visualize.md
  1. Add the following block in gitconfig file :
[alias]  
    graph1 = log --graph --abbrev-commit --decorate --format=format:'%C(blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(bold white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
    graph2 = log --graph --abbrev-commit --decorate --format=format:'%C(blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n''%C(bold white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
  1. Now run git graph1 or git graph2 in your project folder to view a nice git log
@nitish6174
nitish6174 / mouse_cursor_using_keyboard.md
Last active Oct 6, 2018
Settings to control mouse cursor using keyboard
View mouse_cursor_using_keyboard.md
  1. Open 'Settings' -> 'Universal Access' -> 'Pointing and clicking' -> 'Mouse keys'
  2. Turn that option ON
  3. Now you will be able to move cursor with numpad but the speed will be extremely slow.
  4. Run the following commands in terminal to set a good to do speed :
    sudo apt-get install xkbset
    xkbset ma 60 10 10 5 2
@nitish6174
nitish6174 / bashrc
Last active Jun 12, 2017
Bash aliases for the lazy typers
View bashrc
## Add sudo wherever needed
## list all files in current directory
alias ll="ls -alh"
## apt shorthands
alias sau="sudo apt-get update"
alias sai="sudo apt-get install"
sar() {
sudo apt-get autoremove