{{ message }}

Instantly share code, notes, and snippets.

💭
everyday I'm hustlin'

# Alex Ausch aausch

💭
everyday I'm hustlin'
Last active Dec 24, 2015
http://projecteuler.net/problem=9 A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a2 + b2 = c2 For example, 32 + 42 = 9 + 16 = 25 = 52. There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc.
View euler_9.py
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
 # Copyright 2013, Alex Ausch # Free to use under attribution license: http://creativecommons.org/licenses/by/2.0/ca/ for b in range(1,500): c = (- b ** 2 + 1000 * b - 500000)/(b-1000) a = (c**2 - b**2)**0.5 if (a+b+c) == 1000 and int(a) == a and a > 0: print a,b,c print a * b * c
Last active Dec 24, 2015
http://projecteuler.net/problem=4 A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. Find the largest palindrome made from the product of two 3-digit numbers.
View palindrome_detector.py
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
 # Copyright 2013, Alex Ausch # Free to use under attribution license: http://creativecommons.org/licenses/by/2.0/ca/ def is_palindrome(num): palindrome = str(num) return palindrome == palindrome[::-1] def fn(n): max_palindrome = 1 for x in range(n,1,-1):
Last active Dec 23, 2015
A read-only dictionary, which only contains prime numbers
View prime_set.py
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
 # inspired by http://ceasarjames.wordpress.com/2011/07/10/the-quadratic-sieve/ # # Copyright 2013, Alex Ausch # Free to use under attribution license: http://creativecommons.org/licenses/by/2.0/ca/ try: from collections.abc import Mapping except ImportError: from collections import Mapping
Last active Dec 23, 2015
A read-only dictionary, storing fibonacci numbers
View fib_dict.py
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
 # Copyright 2013, Alex Ausch # Free to use under attribution license: http://creativecommons.org/licenses/by/2.0/ca/ try: from collections.abc import Mapping except ImportError: from collections import Mapping class FibDict(Mapping): """A FibDict object stores the Fibonnaci sequence, mapping numbers
Last active Dec 23, 2015
Python script for running touch on a list of directories, and their contents
View recursive_touch.py
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 # # run with: python recursive_touch.py # touches all contents of , and recurses into subdirectories. # WARNING! don't run unless you actually intend to do all that touching. # some things, should not be touched. # # Copyright 2013, Alex Ausch # Free to use under attribution license: http://creativecommons.org/licenses/by/2.0/ca/ #
Created Aug 15, 2014
View generate_idea_file_for_activator.sh
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
 ./activator gen-idea
Last active Aug 29, 2015
easy to understand, and use, ruby based, contact generator
View contact_generator.rb
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
 # Copyright 2014, Alex Ausch # Free to use under attribution license: http://creativecommons.org/licenses/by/2.0/ca/ puts ARGV.count if ARGV.count < 1 puts "Missing argument - number of contacts" exit end
Created Mar 31, 2014
View check_and_restart.sh
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/perl #from this post: http://www.linuxquestions.org/questions/programming-9/script-to-see-if-a-process-ir-running-if-not-start-it-339618/ open PROS, "ps -ef|grep process |"; while (\$line = ){ unless (\$line =~ m/grep/){ exit; }