This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Vim indent file | |
" Language: Yaml | |
" Author: Ian Young | |
" Get it bundled for pathogen: https://github.com/avakhov/vim-yaml | |
if exists("b:did_indent") | |
finish | |
endif | |
"runtime! indent/ruby.vim | |
"unlet! b:did_indent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# bootstrap a container to accept ansible. | |
key_location="https://github.com/jacqueswww.keys" | |
sudo apt-get install -y curl python | |
sudo mkdir /root/.ssh/ | |
sudo chmod 600 /root/.ssh/ | |
sudo curl $key_location > /root/.ssh/authorized_keys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo apt-get install openjdk-7-jre | |
wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - | |
sudo echo "deb http://packages.elastic.co/elasticsearch/2.x/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list | |
sudo apt-get update && sudo apt-get install elasticsearch | |
sudo update-rc.d elasticsearch defaults 95 10 | |
sudo service elasticsearch start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
def ipv6(s): | |
group_split = s.split(':') | |
if len(group_split) == 8: | |
for sub in group_split: | |
try: | |
ip_val = int(sub, 16) | |
if 0 <= ip_val <= 65535: | |
continue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TEST_COMMAND="python manage.py test --keepdb --no-input --failfast "$1 | |
$TEST_COMMAND | |
while find ./ -name '*.py' | inotifywait --fromfile - -e modify; | |
do | |
$TEST_COMMAND | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def dict_contains(primary, secondary): | |
""" | |
Does primary dict contains all the same items as secondary. | |
""" | |
assert isinstance(primary, dict) | |
assert isinstance(secondary, dict) | |
for key, val in secondary.items(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from django.apps import apps | |
from django.conf import settings | |
from django.core.management.base import BaseCommand | |
from django.db import connections | |
from django.db.migrations.autodetector import MigrationAutodetector | |
from django.db.migrations.executor import MigrationExecutor | |
from django.db.migrations.state import ProjectState | |
from django.db.utils import OperationalError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.apps import apps | |
def get_models_with_file_fields(): | |
for model in apps.get_models(): | |
if any(field.__class__.__name__ in ('FileField', 'ImageField') | |
for field in model._meta.fields): | |
print(model) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
class MemoryUsage: | |
# thanks to http://code.activestate.com/recipes/286222/ | |
def __init__(self): | |
self._proc_status = '/proc/%d/status' % os.getpid() | |
self._scale = { | |
'kB': 1024.0, 'mB': 1024.0 * 1024.0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Viper Port of MyToken | |
# Originally found at https://www.ethereum.org/token | |
# Public variables of the token | |
name: public(bytes32) | |
symbol: public(bytes32) | |
totalSupply: public(num) | |
decimals: public(num) | |
balanceOf: public(num256[address]) |
OlderNewer