Skip to content

Instantly share code, notes, and snippets.

@philipbjorge
philipbjorge / EmptySetLiteral.py
Last active March 2, 2016 12:10
Empty Set Literal Notation for Python - {_}
"""
Python's set data structure is the only one without a literal
notation for an empty set.
http://excess.org/article/2012/11/python-container-literals/
This is an ast transformer to add an empty set notation with the
following form:
empty_set = {_}

Note: I'm updating this gist as I encounter new reviews, so make sure you're reading the latest revision!

Just as the previous year I collected (and keep doing so) links to various summaries and takeaways from this year's NIPS.

from itertools import chain, repeat
import sys
import types
# byte offsets for structures
if hasattr(sys, 'gettotalrefcount'):
# under PyDEBUG builds
_f_localsplus_offset = 392
_ob_item_offset = 40
else:
@Cyberek
Cyberek / README.txt
Last active September 9, 2021 00:17
Starting Kodi automatically on Raspbian Jessie and Stretch
So you were able to install Kodi via "sudo apt-get install kodi" but have no idea how to force it to autostart on boot?
You have tried all those googled solutions such as adding kodi-standalone to .bashrc, creating init.d script but nothing worked?
This is the right place to get the answer.
For some reason, the current version of Kodi doesnt provide 2 important files:
/etc/init.d/kodi
/etc/default/kodi
@brannondorsey
brannondorsey / pix2pix_paper_notes.md
Last active January 3, 2022 09:57
Notes on the Pix2Pix (pixel-level image-to-image translation) Arxiv paper

Image-to-Image Translation with Conditional Adversarial Networks

Notes from arXiv:1611.07004v1 [cs.CV] 21 Nov 2016

  • Euclidean distance between predicted and ground truth pixels is not a good method of judging similarity because it yields blurry images.
  • GANs learn a loss function rather than using an existing one.
  • GANs learn a loss that tries to classify if the output image is real or fake, while simultaneously training a generative model to minimize this loss.
  • Conditional GANs (cGANs) learn a mapping from observed image x and random noise vector z to y: y = f(x, z)
  • The generator G is trained to produce outputs that cannot be distinguished from "real" images by an adversarially trained discrimintor, D which is trained to do as well as possible at detecting the generator's "fakes".
  • The discriminator D, learns to classify between real and synthesized pairs. The generator learns to fool the discriminator.
  • Unlike an unconditional GAN, both th
@georgexsh
georgexsh / goto.py
Created September 18, 2017 07:47
python goto with system trace function
import sys
def j(lineno):
frame = sys._getframe().f_back
called_from = frame
def hook(frame, event, arg):
if event == 'line' and frame == called_from:
try:
frame.f_lineno = lineno
@whophil
whophil / jupyter.service
Last active October 30, 2023 16:33 — forked from doowon/jupyter_systemd
A systemd script for running a Jupyter notebook server.
# After Ubuntu 16.04, Systemd becomes the default.
# It is simpler than https://gist.github.com/Doowon/38910829898a6624ce4ed554f082c4dd
[Unit]
Description=Jupyter Notebook
[Service]
Type=simple
PIDFile=/run/jupyter.pid
ExecStart=/home/phil/Enthought/Canopy_64bit/User/bin/jupyter-notebook --config=/home/phil/.jupyter/jupyter_notebook_config.py
@gauravbarthwal
gauravbarthwal / Multi-Part zip extraction in Ubuntu.txt
Last active May 8, 2024 07:47
How to extract multi-part .zip, .z01, .z02 files in ubuntu
Download/Copy all related *.zip files in one directory.
Open terminal and change to that directory which has all zip files.
Enter command zip -s- FILE_NAME.zip -O COMBINED_FILE.zip
Enter unzip COMBINED_FILE.zip

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name: