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
import getch | |
while True: | |
# ... | |
char = getch.getch() # User input, but not displayed on the screen | |
# or | |
#char = getch.getche() # also displayed on the screen | |
print char |
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
#https://pythonhosted.org/pypng/ex.html | |
import png | |
import time | |
def map2png(name, amap, w, h): | |
amap2 = list(amap) | |
for i in range(len(amap2)): |
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
from pybrain.tools.shortcuts import buildNetwork | |
from pybrain.structure import FeedForwardNetwork | |
from pybrain.datasets import SupervisedDataSet | |
from pybrain.supervised.trainers import BackpropTrainer | |
from pybrain.structure import LinearLayer, SigmoidLayer, TanhLayer | |
from pybrain.structure import FullConnection | |
import random | |
def int2bin(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
from pybrain.tools.shortcuts import buildNetwork | |
from pybrain.structure import FeedForwardNetwork | |
from pybrain.datasets import SupervisedDataSet | |
from pybrain.supervised.trainers import BackpropTrainer | |
from pybrain.structure import LinearLayer, SigmoidLayer, TanhLayer | |
from pybrain.structure import FullConnection | |
import random | |
def int2bin(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
import pyttsx | |
engine = pyttsx.init() | |
engine.setProperty('rate', 100) | |
voices = engine.getProperty('voices') | |
engine.setProperty('voice', voices[1].id) | |
engine.say("A robot is a mechanical or virtual artificial agent, usually an electro-mechanical machine that is guided by a computer program or electronic circuitry.") | |
engine.runAndWait() |
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
<?php | |
$operators=array("+","-","*","/"); | |
$numbers=array("0","1","2","3","4","5","6","7","8","9"); | |
$a=array(); | |
function findNodesFirst($exp,&$buff,&$nums,&$op){ | |
//Check $exp is empty? | |
$newExp=""; |
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
from urllib2 import Request, urlopen, URLError | |
def findURL(page_srt, res): | |
try: | |
att = "url"+res | |
start_ind = page_srt.index(att) | |
end_ind = page_srt.index("?",start_ind) | |
url = page_srt[(start_ind+len(att)+1):end_ind] | |
return url | |
except: |
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
import tweepy | |
import os | |
import json | |
# Consumer keys and access tokens | |
consumer_key = '' | |
consumer_secret = '' | |
access_token = '' | |
access_token_secret = '' |
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
import tweepy | |
import os | |
# Consumer keys and access tokens, used for OAuth | |
consumer_key = '' | |
consumer_secret = '' | |
access_token = '' | |
access_token_secret = '' | |
# OAuth process, using the keys and tokens |
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
#include <iostream> | |
#include <string> | |
using namespace std; | |
bool BracketsInclusion(string str){ | |
int length = str.length(); | |
// Remove everything besides brackets | |
string bstr =""; | |
for(int i = 0; i<length; i++){ |