Skip to content

Instantly share code, notes, and snippets.

View w1ndy's full-sized avatar

Di Weng w1ndy

View GitHub Profile
import requests
import re
import math
import traceback
from bs4 import BeautifulSoup
UID = '' # Put your UID here
member_auth = '' # Put your "member_auth" cookie here
ItemsPerPage = 25
import os
import re
from bs4 import BeautifulSoup
from mutagen.easymp4 import EasyMP4
from mutagen.flac import FLAC
from mutagen.apev2 import APEv2
from mutagen.easyid3 import EasyID3
Path = ""
AllowFallbackToRawFileName = True
@w1ndy
w1ndy / brick.jpg
Last active May 26, 2017 03:24
3D Maze in Python
brick.jpg
@w1ndy
w1ndy / quad.fs
Last active November 28, 2015 06:22
raytracer.py
#version 130
/* This comes interpolated from the vertex shader */
in vec2 texcoord;
/* The texture we are going to sample */
uniform sampler2D tex;
out vec4 color;
@w1ndy
w1ndy / qkcj.py
Created November 8, 2015 14:53
Shandong University Course Selector
#!/usr/bin/python
# required libraries: requests beautifulsoup4
# please fill in target_class, user, pwd
import requests
import random
import multiprocessing
from bs4 import BeautifulSoup
from time import sleep, ctime
@w1ndy
w1ndy / run.fish
Created December 22, 2015 06:04
Automated survey submitter using PhantomJS
#!/bin/fish
phantomjs --ssl-protocol=any survey.js 100
for i in (seq 0 99)
diff correct.png cap$i.png
end
rm *.png
@w1ndy
w1ndy / lpsolve.py
Created December 23, 2015 05:32
Simple python library for linear programming solving
from copy import deepcopy
from fractions import Fraction
def find(eqns):
x = -1
a = 0
en = len(eqns)
vn = len(eqns[0])
for i in range(0, vn - 1):
if eqns[0][i] > a:
@w1ndy
w1ndy / mktime_quick.hpp
Last active November 23, 2023 07:40
Lock-free version of mktime (converting "struct tm" to UNIX timestamp) without considering timezone
#pragma once
#include <cassert>
#include <ctime>
#define ISLEAP(x) (((x) % 4 == 0 && (x) % 100 != 0) || ((x) % 400 == 0))
#define LEAPDELTA(x, y) ((ISLEAP(x) && (y) >= 2) ? 86400 : 0)
time_t mktime_quick(struct tm const &p)
{

Keybase proof

I hereby claim:

  • I am w1ndy on github.
  • I am skies457 (https://keybase.io/skies457) on keybase.
  • I have a public key whose fingerprint is E57E F50F 6B90 47AF CA6B 2FA6 743D C317 CCB3 9680

To claim this, I am signing this object:

@w1ndy
w1ndy / cspline.js
Created August 6, 2016 13:46
Evaluating cardinal splines
/*global sampler, drawPoints, pointString, lastOf */
function CSpline(points, variance) {
this.tension = 0.2;
this.points = points;
this.variance = variance || points.map(function () { return 0; });
this.interval = this.points[this._nextpi(0)].x - this.points[0].x;
this.tangent = points.map(function (d, i) {
var previ = this._prevpi(i),
nexti = this._nextpi(i);