Skip to content

Instantly share code, notes, and snippets.

View WangYihang's full-sized avatar
🎯
Focusing

Yihang Wang WangYihang

🎯
Focusing
View GitHub Profile
@WangYihang
WangYihang / main.py
Last active April 12, 2025 02:55
The Similarity of Anti-Bot Mechanisms (JavaScript Challenge)
import glob
import os
import ssdeep
import requests
def download_file(url, filename):
"""Download a file from a URL and save it to a local filename"""
print(f"Downloading {url} to {filename}")
response = requests.get(url, stream=True)
@WangYihang
WangYihang / coverage-collector.php
Created March 24, 2025 12:20
PHP Coverage Collection
<?php
declare(strict_types=1);
/**
* Code Coverage Handler
*
* Handles code coverage collection using PCOV for individual requests
*/
class CoverageHandler
{
@WangYihang
WangYihang / venn.py
Created March 13, 2025 13:22
Venn Diagram
from reportlab.pdfgen import canvas
from reportlab.lib.colors import red, blue, black
from reportlab.lib.units import inch
def wrapper(func, output_file="output.pdf"):
def inner(*args, **kwargs):
c = canvas.Canvas(output_file)
func(c, *args, **kwargs)
c.save()
return inner
import math
import random
import matplotlib.pyplot as plt
def generate_candidates(M):
r = list(range(M))
random.shuffle(r)
return r
def percent_n_in_m_rule(N, M):
@WangYihang
WangYihang / root-of-an-equation.scm
Last active January 22, 2022 16:58
Structure and Interpretation of Computer Programs - Section 1.3.3 Procedures as General Methods
; Calculate the root of an equation using numerical computation
; (scheme is hard to write :(
; 2022-01-23
; Yihang Wang <[email protected]>
(define (same-sign? a b) (or (and (>= a 0) (>= b 0)) (and (<= a 0) (<= b 0))))
(define (average a b) (/ (+ a b) 2))
(define (abs x) (cond
((< x 0) (- x))
((= x 0) 0)
upstream jupyter-notebook {
server localhost:8888;
}
server{
listen 8080;
server_name notebook.example.com;
location / {
proxy_pass http://jupyter-notebook;
'''
Solution for XOR challenge (http://scz.617.cn:8/misc/202007101723.txt)
'''
from termcolor import colored
from colorama import init
import string
import math
import shlex
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/prctl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <syslog.h>
#include <unistd.h>
from sys import version
import semver
import requests
import itertools
from bs4 import BeautifulSoup
def md5(data):
if type(data) is str:
data = bytes(data, encoding='utf-8')
return __import__('hashlib').md5(data).hexdigest()
@WangYihang
WangYihang / brainfuck.c
Last active September 5, 2021 13:01
BrainFuck Interpreter in C
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
/**
* BrainFuck Interpreter in C [1-2]
* Wang Yihang <[email protected]>
*
* == Run