Skip to content

Instantly share code, notes, and snippets.

@theSage21
theSage21 / mailer.py
Last active January 15, 2024 03:08
Sending Files to My Kindle From Arxiv
# encoding: utf-8
# Install: pipenv install requests bs4 --python 3
# Usage: python mailer.py https://arxiv.org/abs/1805.12076
# Always supply an arxiv ABS page!!!
import sys
import os
import smtplib
import requests
@theSage21
theSage21 / regex-engine.py
Created May 14, 2016 07:24
A very simple regular expression engine for learning purposes
# Define some special things
SPECIAL = '*|'
ALPHABET = '10'
EPSILON = None
# functions
def automaton_print(automaton):
"Neatly prints the automaton"
states, alphabet, start, final, transfer = automaton
print('STATES : ', states)
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)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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:
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