Skip to content

Instantly share code, notes, and snippets.

@rupython
rupython / main.py
Created February 1, 2019 19:34
From: Artemy
print("Just testin'")
@rupython
rupython / main.py
Created February 1, 2019 19:35
From: Artemy
print("Just testin'")
@rupython
rupython / zz.py
Created February 1, 2019 19:36
From: Artemy
print("Surprise")
@rupython
rupython / zz.py
Created February 1, 2019 19:37
From: Artemy
print("Surprise")
@rupython
rupython / main.py
Created February 5, 2019 10:26
From: Zart
>>> dis.dis('''\
... a = 10
... while a:
... a -= 1
... if a < 2:
... break
... print(a)
... ''')
1 0 LOAD_CONST 0 (10)
2 STORE_NAME 0 (a)
@rupython
rupython / main.py
Created February 5, 2019 10:37
From: Slam!
.
@rupython
rupython / main.py
Created February 7, 2019 17:47
From: Zark
`199.72.81.55 - - [01/Jul/1995:00:00:01 -0400] "GET /history/apollo/ HTTP/1.0" 200 6245
unicomp6.unicomp.net - - [01/Jul/1995:00:00:06 -0400] "GET /shuttle/countdown/ HTTP/1.0" 200 3985
199.120.110.21 - - [01/Jul/1995:00:00:09 -0400] "GET /shuttle/missions/sts-73/mission-sts-73.html HTTP/1.0" 200 4085
burger.letters.com - - [01/Jul/1995:00:00:11 -0400] "GET /shuttle/countdown/liftoff.html HTTP/1.0" 304 0
199.120.110.21 - - [01/Jul/1995:00:00:11 -0400] "GET /shuttle/missions/sts-73/sts-73-patch-small.gif HTTP/1.0" 200 4179
burger.letters.com - - [01/Jul/1995:00:00:12 -0400] "GET /images/NASA-logosmall.gif HTTP/1.0" 304 0
burger.letters.com - - [01/Jul/1995:00:00:12 -0400] "GET /shuttle/countdown/video/livevideo.gif HTTP/1.0" 200 0
205.212.115.106 - - [01/Jul/1995:00:00:12 -0400] "GET /shuttle/countdown/countdown.html HTTP/1.0" 200 3985
d104.aa.net - - [01/Jul/1995:00:00:13 -0400] "GET /shuttle/countdown/ HTTP/1.0" 200 3985`
@rupython
rupython / main.py
Created February 10, 2019 15:50
From: Exillio
Имею такой Json. Необходимо вытащить в одну строку через - (тире) [dates] -> [games] -> [teams] -> [away] -> [name] и [dates] -> [games] -> [teams] -> [home] -> [name] вот такой код сейчас - https://pastebin.com/QNQ6W0P2. все пробовал, максимум что вытащил списком это gamePk
@rupython
rupython / main.py
Created February 13, 2019 15:24
From: Ярослав
def f(x):
return x**5-x-0.2
def root(f,a,b,e):
x=(a+b)/2
while abs(b-a)>e:
if f(b)*f(x)==0:
return x
break
elif f(b)*f(x)<0:
a=x
@rupython
rupython / main.py
Created February 13, 2019 19:59
From: Андр
class DBExecutor(): def init(self, connection_params): self._connection_params = connection_params self._connection = None def _connect(self): self._connection = pymysql.connect(self._connection_params) def execute(self, sql, *args, kwargs): if not (self._connection and self._connection.ping(True)): self._connect(): with self._connection.cursor() as cursor: cursor.execute(sql, *args, kwargs) self._connection.commit() # использование db_executor = DBExecutor(host='127.0.0.1', user='root', password='', db='python', charset='utf8mb4', cursorclass=pymysql.cursors.DictCursor, autocommit=True) db_executor.execute("INSERT INTO scaner (number) VALUES (%s)", ('text',))