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 { |
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
#!/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
#!/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
# 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
# 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
# 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
#!/usr/bin/python | |
# For the reddit daily programmer challenge | |
# Challenge: http://www.reddit.com/r/dailyprogrammer/comments/y2lbv/8102012_challenge_87_difficult_sokoban_game/ | |
# Solution: http://www.reddit.com/r/dailyprogrammer/comments/y2lbv/8102012_challenge_87_difficult_sokoban_game/c5rv38d | |
# by @dvoiss on github / @daveasaurus on reddit | |
# Uses curses and plays in the terminal. This started out pretty minimal but | |
# then grew a bit in complexity, so it isn't very clean: the grid is a |
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/env python | |
# convert english to pig-latin and pig-latin to english | |
# solution for: http://programmingpraxis.com/2009/06/02/pig-latin/2/ | |
# rules: | |
# words that start with a consonant and followed immediately by a vowel, | |
# such as 'sorry' become 'orry-say', (first letter plus 'ay') | |
# words that start with vowels: 'amazing' => 'amazing-way' ('way' is appended) |
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 | |
# Challenge: http://www.reddit.com/r/dailyprogrammer/comments/xx97s/882012_challenge_86_intermediate_weekday/ | |
# Solution: http://www.reddit.com/r/dailyprogrammer/comments/xx97s/882012_challenge_86_intermediate_weekday/c5qgu1k | |
# Run code online: http://ideone.com/HIyf7 | |
import sys | |
# this example assumes proper dates are entered (there are no safety checks performed) | |
if len(sys.argv) == 1: |
NewerOlder