Skip to content

Instantly share code, notes, and snippets.

@ruxi
ruxi / .gitignore
Created November 3, 2019 09:21 — forked from smoser/.gitignore
cloud-init ubuntu nocloud example with network config
*.img
*.raw
from contextlib import contextmanager
import sys, os
@contextmanager
def suppress_stdout():
"""
source: https://gist.github.com/djsmith42/3956189
usage:
print "You can see this"
with suppress_stdout():
from contextlib import contextmanager
import sys, os
@contextmanager
def suppress_stdout():
with open(os.devnull, "w") as devnull:
old_stdout = sys.stdout
sys.stdout = devnull
try:
yield
@ruxi
ruxi / bobp-python.md
Created November 10, 2016 22:15 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@ruxi
ruxi / nbmerge.py
Created November 10, 2016 19:47 — forked from fperez/nbmerge.py
Merge/concatenate multiple IPython notebooks into one.
#!/usr/bin/env python
# Note, updated version of
# https://github.com/ipython/ipython-in-depth/blob/master/tools/nbmerge.py
"""
usage:
python nbmerge.py A.ipynb B.ipynb C.ipynb > merged.ipynb
"""
import io
@ruxi
ruxi / GitHub protocol comparison.md
Created March 11, 2016 04:39
A comparison of protocols offered by GitHub (for #git on Freenode).

Primary differences between SSH and HTTPS. This post is specifically about accessing Git repositories on GitHub.

Protocols to choose from when cloning:

plain Git, aka git://github.com/

  • Does not add security beyond what Git itself provides. The server is not verified.

    If you clone a repository over git://, you should check if the latest commit's hash is correct.