가끔식 로또할때가 있어서 그냥 무식하게 random으로 찍기는 싫어서 약간의 custom number를 만들수 있도록 간단히 만들어봄.
백만개씩 만들어놓고 당첨번호랑 매칭하는 것도 만들 예정임. 일주일에 백만개씩 사도 로또에 담청될수 없다는 교훈을 가르칠기 위해. ^^
----------------------
import random
import time
#TODO: use current time as random seed
lotterynumbers = range(1,71) # 1-70
# previous winning numbers
# high numbers
# not luckey numbers
exclude_numbers = [12,27,29,43,68,
66,67,69,70, #68s
4,22,53]
#print lotterynumbers
for num in exclude_numbers:
lotterynumbers.remove(num)
print "Number Pool: %s" %lotterynumbers
print "------------------------"
x = 0
while x < 10:
#lotterynumbers.append(random.randint(1, 10))
#lotterynumbers.append(random.sample(range(10), 6))
#lotterynumbers.sort()
fredarray = random.sample(lotterynumbers, 5)
fredarray.sort()
print fredarray
#print lotterynumbers
x += 1
print;print
#Mega Number - one lucky number
mega_numbers = range(1,26) # 1-25
mega_exclude_numbers = [1, 2, 22, 25]
for num in mega_exclude_numbers:
mega_numbers.remove(num)
print "Mega Number Pool: %s" %mega_numbers
print "------------------------"
y = 0
while y < 5:
print random.sample(mega_numbers, 1)
y += 1
#end of the program
#
import urllib2
import json
def printResults(data):
# Use the json module to load the string data into a dictionary
theJSON = json.loads(data)
# now we can access the contents of the JSON like any other Python object
if "title" in theJSON["metadata"]:
print theJSON["metadata"]["title"]
# output the number of events, plus the magnitude and each event name
count = theJSON["metadata"]["count"];
print "Yesterday Total " + str(count) + " events recorded"
# for each event, print the place where it occurred
# for i in theJSON["features"]:
# print i["properties"]["place"]
# print the events that only have a magnitude greater than 4
print"\n"
print "Magnitude greater than 4:\n"
for i in theJSON["features"]:
if i["properties"]["mag"] >= 4.0:
print "%2.1f" % i["properties"]["mag"], i["properties"]["place"]
# print only the events where at least 1 person reported feeling something
print "\n"
print "Events that were felt:\n"
for i in theJSON["features"]:
feltReports = i["properties"]["felt"]
placeOccur = i["properties"]["place"]
if (feltReports != None) & (feltReports > 0):
if (i["properties"]["place"].find("California") > 0 or i["properties"]["place"].find("Mexico") > 0) :
print "*****************************************"
print "%2.1f" % i["properties"]["mag"], i["properties"]["place"], " reported " + str(feltReports) + " times"
def main():
# define a variable to hold the source URL
# In this case we'll use the free data feed from the USGS
# This feed lists all earthquakes for the last day larger than Mag 2.5
#Fred: http://earthquake.usgs.gov/earthquakes/feed/v1.0/geojson.php
urlData = "http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_day.geojson"
# Open the URL and read the data
webUrl = urllib2.urlopen(urlData)
print ("USGS is alive, response=%d" % webUrl.getcode())
if (webUrl.getcode() == 200):
data = webUrl.read()
# print out our customized results
printResults(data)
else:
print "Received an error from server, cannot retrieve results " + str(webUrl.getcode())
if __name__ == "__main__":
main()
오디오/음성를 인식해서 text로 바꿔주는 기능은 open source로도 많이 있습니다.
오래된 기술인데 사실 어떤 application에 쓰일수 있느냐가 key인데 재밌는 application이 많이 있는데도 아직까지 많이 퍼지지 않은것이 궁금해서 이것저것 보고 있습니다.
Pydub
Pydub lets you do stuff to audio in a way that isn't stupid.
Manipulate audio with a simple and easy high level interface
Audiogrep transcribes audio files and then creates "audio supercuts" based on search phrases. It usesCMU Pocketsphinx for speech-to-text and pydub to stitch things together.
pip install audiogrep
How to use it
First, transcribe the audio (you'll only need to do this once per audio track, but it can take some time)
# transcribes all mp3s in the selected folder
audiogrep --input path/to/*.mp3 --transcribe
이 명령어만 쓰고 ouput된 text에 따로 grep하는게 좋을것 같습니다.
# returns all phrases with the word 'word' in them
audiogrep --input path/to/*.mp3 --search 'word'
pip is a package management system used to install and manage software packages written in Python. Many packages can be found in the Python Package Index (PyPI).
한 video를 보게됐는데 프로그래밍 언어의 점유율에 대해서 잘 보여주고 있습니다. Github프로젝트로 가장 많은 수를 차지하는 언어는 JavaScript입니다. 이전에 포스팅했던 Popcorn Time과 NPM이런것들이 JavaScript언어로 되어 있음에 깜짝놀랐다는 글이었죠. (NPM engine은 C++입니다만)
JAVA는 꾸준히 인기있는 언어이고요.
Perl은 죽었다고 봐야하겠고요.
PHP가 web programming에서는 꾸준히 있기를 유지하고 있네요.
JavaScript(JS)도 꾸준히 유지되네요.
Python은 폭발적으로 증가하고 있고요.
-----------------------
그러면서 티스토리 IT블로그에서 본 어떤 개발자들의 말이 생각났습니다.
누가 C/C++를 요즘 공부하냐는 말, C++는 이미 죽었다는 말. 점유율이나 대다수 사람들이 공부하는 추세를 보면 C/C++를 하는 사람이 없지요. 너무 어렵고 앞으로 사용하는 분야가 너무 없다고 생각되지요.
맞는 말이지만, 어떤 engine을 생각할때 저 휘에 있는 언어로 만들어서 팔수있는게 있습니까? 대다수의 회사는 C/C++로 engine/OS/Framework을 만들어 팝니다(or open source로 공개합니다.) 저 위에 언어는 새로운 새대의 언어이지만 UI에 가까워있는 일만 할수 있습니다. 좀더 장기적으로 오래가는 일을 하려면 그 아래의 일도 하는게 좋겠지요. 그래서 젊은 개발자들은 C/C++를 계속 배우는게 자신의 미래를 대비하는데 좋을거라 생각이 듭니다.(물론 하나도 잘 하기 힘든데라고 생각하면 하나에 집중해야겠지요)
젊은 개발자들이 저 위에 있는 언어만 한다면 이미 시장에서 잔뼈가 굵은 사람들의 job은 오래동안 상당히 안정적일것이라 생각이 됩니다. 우리는 좋은 세상에 태어난 것을 고맙게 생각하며 은퇴할수 있을까 궁금하네요.