Skip to content

Instantly share code, notes, and snippets.

@calvingiles
calvingiles / Theming-Slack-OSX.md
Last active January 10, 2019 11:17 — forked from DrewML/Theming-Slack-OSX.md
Theming Slack for OSX

Theming Slack for OSX

So, you love Slack, but you hate applications with large white backgrounds? Why not use Dark Mode!

Unfortunately, Slack does not have a Dark Mode, although it's on their list of possibilities.

But, don't fret - there is a solution! Because the slack native desktop apps are just wrappers around a web app, we can inject our own CSS to customize the application to our liking.

How to (OSX Only)

@calvingiles
calvingiles / graph_set.py
Created June 10, 2016 17:29
Pure python methods for modelling simple graphs and building a set of disjoint graphs edge by ende
class Graph(object):
def __init__(self, nodes, edges=None):
self.nodes = nodes
self.edges = set()
self.add_edges(edges or set())
def __hash__(self):
return hash(frozenset(self.edges)) + hash(frozenset(self.nodes))
def __repr__(self):
@calvingiles
calvingiles / data-science-environment-fig.yml
Last active May 26, 2016 07:24
fig.yml for setting up a data science environment
notebooks:
command: echo created
image: busybox
volumes:
- "~/Google Drive/notebooks:/notebooks"
data:
command: echo created
image: busybox
volumes:
- "~/Google Drive/data:/data"
@calvingiles
calvingiles / start_data_science_env.py
Last active August 29, 2015 14:10
Start data science environment container
from __future__ import print_function
import os, time, argparse
from subprocess import call, check_call, check_output
def stop_cmd(name):
return ['docker', 'stop', name], False
@calvingiles
calvingiles / stats_coroutines.py
Created September 9, 2014 10:22
Online mean and variance with generators
def online_mean():
"""
Return an initialised generator for online mean (next() has been called).
"""
omean = _online_mean()
next(omean)
return omean
def _online_mean():
@calvingiles
calvingiles / yield_from_example.py
Created September 9, 2014 09:11
Example of yield as filter
"""
An example of using the `yield from` syntax in python 3 and a generator expression than mimics this.
"""
def yield_only_odd(i):
'''
Yield i if and only if i is odd.
This is a generator that yields zero or one times.
'''
# IPython magic to check for PEP8 compliance.
# Author: Juan Luis Cano <juanlu001@gmail.com>
"""IPython magic to check for PEP8 compliance.
To use it, type
```%load_ext pep8magic```
and then
@calvingiles
calvingiles / haiku.py
Last active August 29, 2015 14:04 — forked from friggeri/haiku
python function to generate heroku-like names
import random
def get_haiku(n_adj=1, sep='-'):
'''
return short haiku, seperated by sep.
Original from https://gist.github.com/afriggeri/1266756
'''
adjs = [
alpha country numerical
BEL Belgium 056
BLZ Belize 084
BEN Benin 204
BMU Bermuda 060
BTN Bhutan 064
BOL Bolivia (Plurinational State of) 068
BES Bonaire, Saint Eustatius and Saba 535
BIH Bosnia and Herzegovina 070
BWA Botswana 072