Skip to content

Instantly share code, notes, and snippets.

i = 0
while True:
try:
i += 1
if i == 10: i/0
except ZeroDivisionError:
print('Go Free!!')
break
@sizhky
sizhky / inspect signature.md
Last active February 23, 2020 10:16
Inspect a collection
>>>inspect(listofcollections)
'''
0
list `[1,2,3,...]` of len `1345`

1
list `[np.ndarray([[1,2],[3,2],...]) of size (1345x2)
       np.ndarray([list `[2,3,4,...]` of len `7`, list `[2,2,1,...]` of len `15`])
       torch.tensor([[[0.0000,...]]] of size (1345x1x100x100))
# !jbck train.ipynb -> folder.of.train.ipynb/18:[email protected]
ip="train.ipynb"
!echo {ip}
!mkdir -p folder.of.{ip}
!jupyter nbconvert {ip}
!mv {stem(ip)}.html folder.of.{ip}/$(date +%H:%M@%d%b%y)
git clone https://github.com/sizhky/classical-python-problems
git status
git add folder1 folder2 folder3 file1 file2 file*
git status
git commit -m "1.1.1"
git push origin master
@sizhky
sizhky / snippets.json
Created December 29, 2019 13:02
~/.local/share/jupyter/nbextensions/snippets/snippets.json
{
"snippets" : [
{
"name" : "example",
"code" : [
"# This is an example snippet!",
"# To create your own, add a new snippet block to the",
"# snippets.json file in your jupyter nbextensions directory:",
"# /nbextensions/snippets/snippets.json",
"import this"
@sizhky
sizhky / loader.py
Created November 14, 2019 16:50
loader.py
__all__ = ['B','BB','C','choose','crop_from_bb','cv2', 'dumpdill','df2bbs', 'FName','glob','Glob',
'line','loaddill','logger','extn', 'np', 'now','os','pd','parent','Path','pdb',
'plt','puttext','randint', 'rand', 'read','rect','see','show','stem','tqdm','Tqdm']
import cv2, glob, numpy as np, pandas as pd, tqdm, os
import matplotlib#; matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.patheffects as path_effects
import pdb, datetime, dill
from pathlib import Path
@sizhky
sizhky / .spacemacs
Last active August 27, 2020 06:09
.spacemacs
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
;; Ippikayak other buckets
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
@sizhky
sizhky / ~_.config_nvim_init.vim
Last active October 31, 2019 04:33
My vimrc
let mapleader=","
nnoremap : ;
nnoremap ; :
" Normal Clipboard
set clipboard=unnamed
" FILE SEARCHING
set path+=**
set wildmenu
" TAG JUMPING
command! MakeTags !ctags -R .
@sizhky
sizhky / datetime.py
Last active May 4, 2019 11:34
Insert date & time in sublime using a key-stroke
import sublime, sublime_plugin, time
class InsertDatetimeCommand(sublime_plugin.TextCommand):
def run(self, edit):
sel = self.view.sel();
for s in sel:
# o = time.ctime().split()
# o = ' '.join(o[1:3] + ['(' + o[0] + ')'])
# self.view.replace(edit, s, o)
self.view.replace(edit, s, o)
from bokeh.plotting import figure, show
from bokeh.io import output_notebook, push_notebook
%matplotlib inline
output_notebook()
from math import pi
import numpy as np
from time import sleep