Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python3
from Crypto.Signature import PKCS1_v1_5
from Crypto.PublicKey import RSA
import argparse
import socket
import struct
import sys
ADB_AUTH_TOKEN = 1
@lhchavez
lhchavez / parametrizer.py
Created July 30, 2011 06:20
Reads an .svg with a single path made only of cubic Bezier curves and generates a parametric equation to graph it.
#!/usr/bin/python
import Image
import ImageDraw
import math
from xml.dom.minidom import parse
import sys
from mpmath import mp
divisions = 2
{"timestamp":1621980462845,"tag":"runtime.welcome","level":1,"message":"js-debug v1.56.2 started","metadata":{"os":"linux x64","nodeVersion":"v14.16.1","adapterVersion":"1.56.2"}}
{"tag":"dap.receive","timestamp":1621980462531,"metadata":{"connectionId":0,"message":{"command":"initialize","arguments":{"clientID":"replit","clientName":"replit.com","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-us","supportsProgressReporting":true,"supportsInvalidatedEvent":true},"type":"request","seq":1}},"level":0}
{"tag":"dap.send","timestamp":1621980462543,"metadata":{"connectionId":0,"message":{"seq":1,"type":"response","request_seq":1,"command":"initialize","success":true,"body":{"supportsConfigurationDoneRequest":true,"supportsFunctionBreakpoints":false,"supportsConditionalBreakpoints":true,"supportsHitConditionalBreakpoints":true,"supportsEvaluateForHovers":true,"exceptionBreakpointFilters":[{"filt
@lhchavez
lhchavez / cursor_grab_demo.py
Created March 1, 2021 13:39
Demo of the cursor grab
#!/usr/bin/python3
import base64
import io
# import the pygame module, so you can use it
import pygame
MARK_PNG = '''
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAMJJREFUWIXt
@lhchavez
lhchavez / git-push-stack
Last active February 19, 2021 00:58
Tool to upload a stack of commits to GitHub.
#!/usr/bin/python3
"""Tool to upload a stack of commits to GitHub.
This expects a `.git/branch-mapping.yml` file to exist in the repository this
is being run. Example file:
```yaml
commits:
- subject: My cool commit
branch: my-cool-commit
@lhchavez
lhchavez / faux_omegaup.py
Created May 18, 2019 05:20
omegaUp falso
#!/usr/bin/python3
import argparse
import cgi
import http.server
import itertools
import json
import os
import socketserver
import time
@lhchavez
lhchavez / omegaUp problems.ipython
Created January 21, 2019 17:33
omegaUp priors exploration
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# omegaUp quality and difficulty priors\n",
"\n",
"This document explores good priors to use when estimating the problem difficulty and quality before enough actual votes are cast."
]
@lhchavez
lhchavez / omegaup_problems.csv
Created January 21, 2019 16:14
omegaUp problem dataset
visits submissions accepted difficulty quality quality_histogram_1 quality_histogram_2 quality_histogram_3 quality_histogram_4 quality_histogram_5 difficulty_histogram_1 difficulty_histogram_2 difficulty_histogram_3 difficulty_histogram_4 difficulty_histogram_5
0 0 0 0.0
0 56 7 0.0
0 27 10 0.0
0 1097 261 0.0
0 7 1 0.0
0 23 2 0.0
1 45 6 1.56738734117549 3.27889384186382 0 0 0 1 1 0 0 2 0 0
0 3 1 0.0
0 65 35 0.0
@lhchavez
lhchavez / process.py
Created August 3, 2018 02:17
Obtener los issues de GitHub
#!/usr/bin/python3
import json
import os
import subprocess
import sys
def download(page):
print(page, file=sys.stderr)
subprocess.check_call([
@lhchavez
lhchavez / Makefile
Created June 15, 2018 04:22
quark Makefile
golangfiles:=$(shell find src/github.com/omegaup/quark -name '*.go')
assetfiles:=$(shell find src/github.com/omegaup/quark/cmd/omegaup-grader/data/dist)
all: bin/omegaup-grader bin/omegaup-broadcaster bin/omegaup-runner
bin/go-bindata:
go get -u github.com/jteeuwen/go-bindata/...
bin/golint:
go get -u golang.org/x/lint/golint