Skip to content

Instantly share code, notes, and snippets.

View cameronmaske's full-sized avatar

Cameron Maske cameronmaske

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

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 April 3, 2018 20:51
Yapf + Isort Git Hook Pre-commit Script
#!/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
### 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 June 3, 2017 21:44
Setting up Docker DNS for local dev

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 17:12
Python vs Objective C
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"];

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__
[
{
"files": {
"pythonpy/__init__.py": 1,
"pythonpy/__main__.py": 208,
"pythonpy/pycompleter.py": 333,
"setup.py": 60,
"test/test_pythonpy.py": 50
},
"id": "5ba6f1ea925ee4a7edd26236812fac2cd57864db",
import commands
import json
output_name = "commits-over-time"
data = []
past_changes = {}
commits = commands.getstatusoutput(
"git rev-list --all master")[1].split('\n')
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 December 27, 2014 00:38
A script to call out twisters moves written in Python! Only works on OSX.
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)