Skip to content

Instantly share code, notes, and snippets.

@zhangfaen
zhangfaen / SimpleHTTPServerWithUpload.py
Created December 11, 2015 13:26 — forked from UniIsland/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
@zhangfaen
zhangfaen / cnn ocr
Created February 24, 2017 09:31 — forked from xlvector/cnn ocr
# pylint: disable=C0111,too-many-arguments,too-many-instance-attributes,too-many-locals,redefined-outer-name,fixme
# pylint: disable=superfluous-parens, no-member, invalid-name
import sys
sys.path.insert(0, "../../python")
import mxnet as mx
import numpy as np
import cv2, random
from io import BytesIO
from captcha.image import ImageCaptcha
@zhangfaen
zhangfaen / pg-pong.py
Created March 2, 2024 12:10 — forked from karpathy/pg-pong.py
Training a Neural Network ATARI Pong agent with Policy Gradients from raw pixels
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """
import numpy as np
import cPickle as pickle
import gym
# hyperparameters
H = 200 # number of hidden layer neurons
batch_size = 10 # every how many episodes to do a param update?
learning_rate = 1e-4
gamma = 0.99 # discount factor for reward
@zhangfaen
zhangfaen / prover_verifier.py
Created October 15, 2025 13:10 — forked from faabian/prover_verifier.py
Replication of "Winning Gold at IMO 2025 with a Model-Agnostic Verification-and-Refinement Pipeline"
"""
Quick and dirty replication of
"Winning Gold at IMO 2025 with a Model-Agnostic Verification-and-Refinement Pipeline" (https://arxiv.org/abs/2507.15855)
using LangGraph.
Export GOOGLE_API_KEY to run.
Change the model, question and constants directly in the code (no CLI).
"""
import asyncio