This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
/** | |
* Code Coverage Handler | |
* | |
* Handles code coverage collection using PCOV for individual requests | |
*/ | |
class CoverageHandler | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream jupyter-notebook { | |
server localhost:8888; | |
} | |
server{ | |
listen 8080; | |
server_name notebook.example.com; | |
location / { | |
proxy_pass http://jupyter-notebook; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <unistd.h> | |
/** | |
* BrainFuck Interpreter in C [1-2] | |
* Wang Yihang <[email protected]> | |
* | |
* == Run |
NewerOlder