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
# programming praxis: | |
# http://programmingpraxis.com/2011/02/15/google-code-jam-qualification-round-africa-2010/ | |
# "Today's three programming exercises come from the Google Code Jam Qualification Round Africa 2010" | |
# 1. | |
# find the index of the two items that add up to the total credit amount | |
def store_credit(sample, credit): | |
for i, x in enumerate(sample): | |
for j, y in enumerate(sample): | |
if x + y == credit and i != j: |
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
# http://programmingpraxis.com/2009/06/30/steve-yegges-phone-screen-coding-exercises/ | |
# Steve Yegge's Phone screen questions | |
# reverse-string | |
# built-in in python: input[::-1] => "gnirts-tset" | |
def reverse_string(input, input_length): | |
result = "" | |
i = input_length - 1 | |
while i >= 0: | |
result += input[i] |
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
# http://programmingpraxis.com/2010/06/01/unwrapping-a-spiral/ | |
# Unwrapping A Spiral | |
# 1 2 3 4 | |
# 5 6 7 8 | |
# 9 10 11 12 | |
# 13 14 15 16 | |
# 17 18 19 20 | |
# input assumption: |
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
#!/usr/bin/python | |
# For the reddit daily programmer challenge | |
# Challenge: http://www.reddit.com/r/dailyprogrammer/comments/y5sox/8132012_challenge_88_easy_vigen%C3%A8re_cipher/ | |
# Solution: http://www.reddit.com/r/dailyprogrammer/comments/y5sox/8132012_challenge_88_easy_vigen%C3%A8re_cipher/c5socop | |
# by @dvoiss on github / @daveasaurus on reddit | |
from string import ascii_uppercase as up |
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
#!/usr/bin/python | |
# For the reddit daily programmer challenge | |
# Challenge: http://www.reddit.com/r/dailyprogrammer/comments/y5svk/8132012_challenge_88_intermediate_printing_out_a/ | |
# Solution: http://www.reddit.com/r/dailyprogrammer/comments/y5svk/8132012_challenge_88_intermediate_printing_out_a/c5soy7s | |
# run code at http://ideone.com/yFOA4 | |
# by @dvoiss on github / @daveasaurus on reddit | |
# Two variations: |
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
function emu() { | |
green=$(tput setaf 64) | |
reset=$(tput sgr0) | |
# is VBoxManage available on the machine? | |
if hash VBoxManage 2>/dev/null; then | |
# print the emu: | |
echo "${green}" | |
echo ' | |
/-/-=/-= |
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
/* | |
This must be added to ~/.gradle/init.gradle or to a .gradle file under ~/.gradle/init.d/ before applying. | |
initscript { | |
repositories { | |
maven { | |
url "https://plugins.gradle.org/m2/" | |
} | |
} | |
dependencies { |
OlderNewer