Skip to content

Instantly share code, notes, and snippets.

Calvin Giles calvingiles

Block or report user

Report or block calvingiles

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@calvingiles
calvingiles / Theming-Slack-OSX.md
Last active Jan 10, 2019 — forked from DrewML/Theming-Slack-OSX.md
Theming Slack for OSX
View Theming-Slack-OSX.md

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 Jun 10, 2016
Pure python methods for modelling simple graphs and building a set of disjoint graphs edge by ende
View graph_set.py
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
fig.yml for setting up a data science environment
View data-science-environment-fig.yml
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 Aug 29, 2015
Start data science environment container
View start_data_science_env.py
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 Sep 9, 2014
Online mean and variance with generators
View stats_coroutines.py
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 Sep 9, 2014
Example of yield as filter
View yield_from_example.py
"""
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.
'''
View pep8magic.py
# 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 Aug 29, 2015 — forked from friggeri/haiku
python function to generate heroku-like names
View haiku.py
import random
def get_haiku(n_adj=1, sep='-'):
'''
return short haiku, seperated by sep.
Original from https://gist.github.com/afriggeri/1266756
'''
adjs = [
View country_codes.csv
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
You can’t perform that action at this time.