Skip to content

Instantly share code, notes, and snippets.

import requests
payload = {"text": "Mytext", "style": 0, "bias": 0.1}
url = "https://handwriting-generator.herokuapp.com/write"
page = requests.post(url, json=payload)
with open("x.png", "wb") as fl:
fl.write(page.content)
def get_flag():
con = None
flag = None
while True:
try:
con = swat.CAS() if con is None else con
flag = con.CASTable() if flag is None else flag
except Exception:
con = flag = None
else:
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
d = {
"a1": {
"b1": {
"c1": {4, 5},
"c2": "123",
"c3": tuple(),
"c4": 100_000,
"c5": 1 ** 200000,
},
"b2": "something else",
upstream api_servers {
localhost:8080;
localhost:8081;
}
server {
server_name www.deb.com;
root /www;
location / {
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from torch import nn
from torch import optim
from tqdm import tqdm
from tensorboardX import SummaryWriter
import torch
n = 100
inp = torch.Tensor([[0, 0],
[0, 1],
@theSage21
theSage21 / arxivnoredirect.js
Created December 6, 2018 09:45
Don't redirect a pdf link to a abstract link if there's a noredirect=1 parameter
// ==UserScript==
// @name ArxivPdfNoRedirect
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://arxiv.org/abs/*
// @grant none
// @require https://code.jquery.com/jquery-3.2.1.min.js
import numpy as np
from tqdm import tqdm
from multiprocessing import Pool
file_name = "test.gro" #Should be changed
frame_count = 14 #Should be changed
line_count = 4014 #Should be changed
Lz = 2.84 #Should be changed
Lx = 6.95
@theSage21
theSage21 / demo.py
Last active October 12, 2018 06:47
Tqdm + pool.imap_unordered
from tqdm import tqdm
from multiprocessing import Pool
def myfn(x):
return x ** 2
with Pool() as pool:
args = list(range(1_000_000))
work = pool.imap_unordered(myfn, args, chunksize=100)