Skip to content

Instantly share code, notes, and snippets.

i
me
my
myself
we
our
ours
ourselves
you
your
@damianavila
damianavila / remove_output.py
Created April 3, 2013 22:05
Remove output from IPython notebook from the command line (dev version 1.0)
"""
Usage: python remove_output.py notebook.ipynb [ > without_output.ipynb ]
Modified from remove_output by Minrk
"""
import sys
import io
import os
from IPython.nbformat.current import read, write
@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active May 1, 2025 13:21
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@kevinzakka
kevinzakka / data_loader.py
Last active March 16, 2025 18:14
Train, Validation and Test Split for torchvision Datasets
"""
Create train, valid, test iterators for CIFAR-10 [1].
Easily extended to MNIST, CIFAR-100 and Imagenet.
[1]: https://discuss.pytorch.org/t/feedback-on-pytorch-for-kaggle-competitions/2252/4
"""
import torch
import numpy as np
@sizhky
sizhky / prevent_tf_hogging.py
Last active August 6, 2020 05:57
Prevents Tensorflow from hogging all the GPU resources
import tensorflow as tf
config = tf.ConfigProto()
config.gpu_options.allow_growth=True
sess = tf.Session(config=config)
import tensorflow as tf
config = tf.compat.v1.ConfigProto()
config.gpu_options.allow_growth=True
sess = tf.compat.v1.Session(config=config)
@hjertnes
hjertnes / doom.txt
Created April 6, 2018 08:28
Doom Emacs Cheatsheet
SPC
SPC: find file
, switch buffer
. browse files
: MX
; EX
< switch buffer
` eval
u universal arg
x pop up scratch
@dsjt
dsjt / hideshow-config.el
Last active February 10, 2024 06:46
hideshow config for python
(require 'hideshow)
(define-key hs-minor-mode-map (kbd "C-^") 'hs-toggle-hiding)
(add-hook 'python-mode-hook 'hs-minor-mode)
(defun display-code-line-counts (ov)
(when (eq 'code (overlay-get ov 'hs))
(overlay-put ov 'display
(format " ... [%d]"
(count-lines (overlay-start ov)
(overlay-end ov))))
(overlay-put ov 'face '(:foreground "yellow green"))))
@adityajn105
adityajn105 / colab_important_snipplets.py
Last active September 19, 2020 12:11
Google Colab important code snipplets
### Download a file to Local System from Colab
from google.colab import files
with open('example.txt', 'w') as f:
f.write('some content')
files.download('example.txt')
#======================================================================================================
#upload file to Colab from Local System
from google.colab import files
uploaded = files.upload()
@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
i = 0
while True:
try:
i += 1
if i == 10: i/0
except ZeroDivisionError:
print('Go Free!!')
break