Skip to content

Instantly share code, notes, and snippets.

Avatar

Cameron Maske cameronmaske

View GitHub Profile
@cameronmaske
cameronmaske / README.md
Last active Aug 10, 2018
How to use CircleCI's docker executor instead of machine for a Docker Compose project
View README.md

Docker Compose workarounds with CircleCI's docker executor.

Here is an example configuration with the work arounds listed below.

If you need to build Docker images (which our project does) you have to tell Circle to set up a remote docker environment to execute any docker commands. This isn't necessarily complex to add your configuration, it's a simple one-line addition.

However, it is not possible to mount folders (i.e the volumes key in Docker Compose) for containers run by the remote docker instance.

This means you either to set up a separate docker-compose.yml, without volumes and in your Dockerfile, make sure to ADD any folders/code that you need available to run your tests.

@cameronmaske
cameronmaske / pre-commit
Created Apr 3, 2018
Yapf + Isort Git Hook Pre-commit Script
View pre-commit
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
if git rev-parse --verify HEAD >/dev/null 2>&1
View gist:c27c540d6753433f6a29cba561bdc6d6
### Keybase proof
I hereby claim:
* I am cameronmaske on github.
* I am cameronmaske (https://keybase.io/cameronmaske) on keybase.
* I have a public key whose fingerprint is E996 07E8 8E22 59A6 4844 71D8 5609 7552 9ACD 557B
To claim this, I am signing this object:
@cameronmaske
cameronmaske / DNS Local.md
Last active Jun 3, 2017
Setting up Docker DNS for local dev
View DNS Local.md

After setting up your docker machine, change the dns opts to look for a locally running DNS server...

docker-machine ssh
sudo vi /var/lib/boot2docker/profile
# Then add the following...
EXTRA_ARGS='
--label provider=virtualbox
--dns 172.17.0.1
--dns-search dev
@cameronmaske
cameronmaske / shoe.mm
Created May 15, 2016
Python vs Objective C
View shoe.mm
NSArray *shoeOrder = @[@"Charles Smith", @(9.5), @"loafer", @"brown"];
NSMutableDictionary *shoeOrderDict = [[NSMutableDictionary alloc] init];
[shoeOrderDict setObject:[shoeOrder objectAtIndex:0] forKey:@"customer"];
[shoeOrderDict setObject:[shoeOrder objectAtIndex:1] forKey:@"size"];
[shoeOrderDict setObject:[shoeOrder objectAtIndex:2] forKey:@"style"];
[shoeOrderDict setObject:[shoeOrder objectAtIndex:3] forKey:@"color"];
View backends.md

Contributing a new backend.

Contributing a new locking backend is greatly appreciated! Each new backend must implement the following methods...

class Backend(object):
    """
    Each new backend must implement the following methods,
    - __init__
View fig.json
[
{
"files": {
"pythonpy/__init__.py": 1,
"pythonpy/__main__.py": 208,
"pythonpy/pycompleter.py": 333,
"setup.py": 60,
"test/test_pythonpy.py": 50
},
"id": "5ba6f1ea925ee4a7edd26236812fac2cd57864db",
View file_changes_over_time.py
import commands
import json
output_name = "commits-over-time"
data = []
past_changes = {}
commits = commands.getstatusoutput(
"git rev-list --all master")[1].split('\n')
View file-changes-over-time.bash
for commit in $(git rev-list --all master)
do
echo $commit
git checkout $commit > /dev/null 2>&1; find . -name '*.py' | xargs wc -l
echo
done
git checkout master
@cameronmaske
cameronmaske / twister.py
Created Dec 27, 2014
A script to call out twisters moves written in Python! Only works on OSX.
View twister.py
from random import choice
from time import sleep
from subprocess import call
if __name__ == '__main__':
colors = ["green", "yellow", "blue", "red", "in the air", "other player's choice"]
parts = ["left hand", "right hand", "right foot", "left foot"]
while True:
part = choice(parts)
color = choice(colors)