This file contains hidden or 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 | |
# Description: For each directory in ~/Development, descend into it, pull the latest from git and come back out of it. | |
find ~/Development/. -type d -print0 -maxdepth 1 | while IFS= read -r -d '' dir | |
do | |
cd $dir | |
git pull | |
cd ../ | |
done |
This file contains hidden or 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 git import Repo | |
from git import InvalidGitRepositoryError | |
import sys | |
import os | |
import getopt | |
settings = { | |
'repos_path': '/path/to/your/git/repos', | |
'cmd_options': 'b:r:', | |
'this_file_name': 'the_name_of_this_script.py' |
This file contains hidden or 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
#!/usr/bin/env python | |
import os | |
import re | |
import subprocess | |
import sys | |
modified = re.compile('^(?:M|A)(\s+)(?P<name>.*)') | |
CHECKS = [ |
This file contains hidden or 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
''' | |
@desc: An algorithm to reverse a list of characters. | |
@param: A list of characters. | |
''' | |
def reverse_algorithm(my_string): | |
length_of_string, i, reversed_string = len(my_string), 0, [] | |
while i < length_of_string: | |
reversed_string.append(my_string[length_of_string-1-i]) | |
i += 1 | |
return reversed_string |
This file contains hidden or 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
a = [1, 5, 10, 15] | |
b = [3, 6, 8, 20] | |
def query_arrays(a, b, k): | |
i,j=0,0 | |
merged_array = [] | |
while i <= len(a)-1 and j <= len(b)-1: | |
if a[i] < b[j]: | |
merged_array.append(a[i]) | |
i += 1 |
This file contains hidden or 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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant::Config.run do |config| | |
config.vm.define :mongo1 do |mongo1| | |
mongo1.vm.box = "precise64" | |
mongo1.vm.network :hostonly, "192.168.33.20" | |
mongo1.vm.customize ["modifyvm", :id, "--memory", 512] | |
end |
This file contains hidden or 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 celery_app import Celery | |
celery = Celery("tasks", backend="amqp", broker="amqp://guest@localhost") | |
@celery.task(name='test_task') | |
def test_task(): | |
return "boom!" |
This file contains hidden or 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
required = ['a', 'b', 'c'] | |
data = json.loads(request.data) | |
missing_fields = set(required) - set(data.keys()) | |
if len(missing_fields) == 0: | |
return Response(status=200) | |
else: | |
error = {"error": "missing required fields", "missing_fields": missing_fields} | |
return Response(response=dumps(error), status=400) |
This file contains hidden or 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
word_list = [] | |
with open ('word_list.txt', 'r') as words: | |
for word in words: | |
word_list.append(word.strip()) | |
def contains(subword, word): | |
res = [] | |
for s in subword: |
This file contains hidden or 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
sudo apt-get update | |
sudo apt-get install -y libssl1.0.0 openssl | |
# Confirm Build Date is at least Aril 7th 2014 | |
openssl version -a | |
# Restart all services listed by this command: | |
sudo lsof -n | grep ssl | grep DEL |
OlderNewer