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
PUT republishan/forum/459890 | |
{ | |
"name_sender": "asd asd", | |
"description": "یبریبر", | |
"tags": [ | |
"ربیربیر" | |
], | |
"date": "1393-02-30", | |
"follow": [], | |
"photo_sender": "profile.jpg", |
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
1. Download Storm | |
###### | |
2. Set Storm in PATH variable using this code in ~/.profile | |
export PATH=$PATH:/path/to/storm/bin | |
#logout an login again and check storm version | |
3. check Java version (> = 1.7 and JDK Installed) and Python (>=2.7) | |
4.check VirtualEnv in python |
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
chmod u+x runnable file # user + Execute | |
chmod o+x runnable file # other + Execute | |
tar -xvf file.tar | |
# Show right version of java | |
file /etc/alternatives/java /etc/alternatives/javac | |
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
class Mojtaba: | |
SharedVariable = {} | |
def __init__(self): | |
self.MyDict = self.SharedVariable | |
if __name__=='__main__': | |
a = Mojtaba() |
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" : 0, "size" : 20, | |
"sort" : [ { "RE" : {"order" : "desc"}}], | |
"query": { | |
"filtered": { | |
"query" : { | |
"query_string" : { |
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
1.Setup a dns server in ubuntu : http://www.servermom.org/how-to-install-and-setup-bind9-on-ubuntu-server/136/ |
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
1. in Google Developer Console , https://console.developers.google.com/ , create project -> create new Client ID in Credential Link at left sidebar | |
2. |
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
git reset --hard <old-commit-id> | |
git push -f |
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
TIP #1 : Check Membership Efficiently | |
lyrics_list = ['her', 'name', 'is', 'rio'] | |
# Avoid this | |
words = make_wordlist() # Pretend this returns many words that we want to test | |
for word in words: | |
if word in lyrics_list: # Linear time | |
print word, "is in the lyrics" |
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
##Add File Logger | |
import logging | |
logger = logging.getLogger('myapp') | |
hdlr = logging.FileHandler('/var/tmp/myapp.log') | |
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s') | |
hdlr.setFormatter(formatter) | |
logger.addHandler(hdlr) | |
logger.setLevel(logging.WARNING) | |
We can use this logger object now to write entries to the log file: |
OlderNewer