Skip to content

Instantly share code, notes, and snippets.

View thekindlyone's full-sized avatar

Aritra Das thekindlyone

  • @TeamAlbi
  • New Zealand
View GitHub Profile
print ''.join([i[1] for i in enumerate('This page contains examples and source code') if i[0] in [0,2,5,11,12,14,15,23,24,25,26]])
multislice=lambda mainstring,indices: ''.join([i[1] for i in enumerate(mainstring) if i[0] in indices])
print multislice('This page contains examples and source code',[0,2,5,11,12,14,15,23,24,25,26])
In [1]: import webbrowser,re
In [2]: for sub in ('http://www.reddit.com/r/'+subreddit for subreddit in (match.group(1) for match in [re.search('Chaouche: (.+)',line) for line in open('subreddits.txt').read().split('\n')])): webbrowser.open(sub)
(5:56:52 AM) Yassine Chaouche: ContagiousLaughter
(5:57:41 AM) Yassine Chaouche: todayilearned
(5:57:46 AM) Yassine Chaouche: sysadmin
(5:57:51 AM) Yassine Chaouche: happycrowds
(5:57:57 AM) Yassine Chaouche: MusicForConcentration
(5:58:01 AM) Yassine Chaouche: learnprogramming
(5:58:09 AM) Yassine Chaouche: groovesharkplaylists
(5:58:13 AM) Yassine Chaouche: Anticonsumption
(5:58:17 AM) Yassine Chaouche: learnpython
(5:58:32 AM) Yassine Chaouche: AskReddit
>>> reduce(lambda x,y: x+y, xrange(int(raw_input('enter first number: ')),int(raw_input('Enter second number: '))+1) )
enter first number: 4
Enter second number: 7
22
import base64
print ("Welcome to the encoder of Base64 :3")
print ("Please enter your string that you need to encode :")
rawString = input()
encodedString = base64.b64encode(bytes(rawString,'utf-8'))
print ("Encoded :" + str(encodedString) )
@thekindlyone
thekindlyone / output
Created October 2, 2014 08:32
Output of simple.py
D:\pythonary\chall>python simple.py
Please Enter Name: Aritra Das
Enter class (1 for economy, 2 for business): 1
Booking Successful. Your seat is: B1
A B C D
1 O * O O
2 O O O O
3 O O O O
4 O O O O
Legend =>
@thekindlyone
thekindlyone / output
Created October 2, 2014 08:36
Airplane booking thing
D:\pythonary\chall>python simple.py
Please Enter Name: Aritra Das
Enter class (1 for economy, 2 for business): 1
Booking Successful. Your seat is: B1
A B C D
1 O * O O
2 O O O O
3 O O O O
4 O O O O
Legend =>
import os
import requests
from time import asctime,localtime,sleep
import sys
if len(sys.argv)==3:
command=sys.argv[1]
sleeptime=int(sys.argv[2])*60
elif len(sys.argv)==2:
command=sys.argv[1]
sleeptime=30*60 # default 30 mins
import json
import urllib
tmp=open("tmp.txt","a")
url = 'https://www.virustotal.com/vtapi/v2/ip-address/report'
parameters = {'ip': '50.7.189.194', 'apikey': '54ea2f1b2adf87f75eb1c8bbf7aefac361e869d66cc7d8d6b70f084c25cf3e2f'}
response = urllib.urlopen('%s?%s' % (url, urllib.urlencode(parameters))).read()
response_dict = json.loads(response)
resp_code=response_dict.get("response_code")
if resp_code==1:
mesg=response_dict.get("verbose_msg")