Skip to content

Instantly share code, notes, and snippets.

View jerrylususu's full-sized avatar

Neko Null jerrylususu

View GitHub Profile
@vxgmichel
vxgmichel / timecapsule.py
Last active October 15, 2022 14:55
Theoretical solver of the LCS35 Time Capsule Crypto-Puzzle
#!/usr/bin/env python3
"""
Theoretical solver of the LCS35 Time Capsule Crypto-Puzzle
See: https://people.csail.mit.edu/rivest/lcs35-puzzle-description.txt
Example usage:
% time ./timecapsule.py -t 100000
@sparkydogX
sparkydogX / py2_SimpleHTTPServerWithUpload.py
Created February 3, 2019 07:14
在SimpleHTTPServer中加入上传功能
#!/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.
"""
__version__ = "0.2"
__all__ = ["SimpleHTTPRequestHandler"]
@nikolas
nikolas / lerp-color.js
Last active June 29, 2023 14:12 — forked from rosszurowski/lerp-color.js
Linear interpolation for hexadecimal colors.
/**
* A linear interpolator for hex colors.
*
* Based on:
* https://gist.github.com/rosszurowski/67f04465c424a9bc0dae
*
* @param {Number} a (hex color start val)
* @param {Number} b (hex color end val)
* @param {Number} amount (the amount to fade from a to b)
*
@15leesan
15leesan / original.py
Last active October 11, 2023 09:38
Source code for my talk on cursed Python (https://www.youtube.com/watch?v=t863QfAOmlY).
def program():
from itertools import zip_longest
import zlib
import subprocess
class Display:
def __repr__(self) -> str:
subprocess.run([
"feh",
"-xYFqZ",
@trungly
trungly / simple_server.py
Last active February 1, 2024 18:51
A simple Python HTTP server that supports a GET that echoes some request data and a POST that reads a request body, parses it as JSON and responds with part of the data
from BaseHTTPServer import BaseHTTPRequestHandler
import urlparse, json
class GetHandler(BaseHTTPRequestHandler):
def do_GET(self):
parsed_path = urlparse.urlparse(self.path)
message = '\n'.join([
'CLIENT VALUES:',
'client_address=%s (%s)' % (self.client_address,
@yantze
yantze / webdl.sh
Last active March 7, 2024 21:36
wget 整站下载
# 使用 wget 下载整个网站解释
# link: https://www.douban.com/note/536265958
# wget
# --recursive //回归递推也就是包括所有子目录子文件
# --no-clobber //不更改已经存在的文件,也不使用在文件名后添加 .#(# 为数字)的方法写入新的文件
# --page-requisites //下载所有显示完整网页所需的文件,例如图像。
# --html-extension //将所有text/html文档以.html扩展名保存
# --convert-links //转换非相对链接为相对链接
# --no-parent //不要追溯到父目录
# --level=0 // Specify recursion maximum depth level depth.
@alimanfoo
alimanfoo / find_runs.py
Created November 5, 2017 23:53
Find runs of consecutive items in a numpy array.
import numpy as np
def find_runs(x):
"""Find runs of consecutive items in an array."""
# ensure array
x = np.asanyarray(x)
if x.ndim != 1:
raise ValueError('only 1D array supported')
@mistic100
mistic100 / vimeo-downloader.js
Created September 15, 2018 09:01
Download video from Vimeo (chopped m4s files)
// 1. Open the browser developper console on the network tab
// 2. Start the video
// 3. In the dev tab, locate the load of the "master.json" file, copy its full URL
// 4. Run: node vimeo-downloader.js "<URL>"
// 5. Combine the m4v and m4a files with mkvmerge
const fs = require('fs');
const url = require('url');
const https = require('https');
@montasaurus
montasaurus / llmc.sh
Last active April 20, 2024 21:32
AI Shell Command Generator
llmc() {
local system_prompt='Output a command that I can run in a ZSH terminal on macOS to accomplish the following task. Try to make the command self-documenting, using the long version of flags where possible. Output the command first enclosed in a "```zsh" codeblock followed by a concise explanation of how it accomplishes it.'
local temp_file=$(mktemp)
local capturing=true
local command_buffer=""
local first_line=true
local cleaned_up=false # Flag to indicate whether cleanup has been run
cleanup() {
# Only run cleanup if it hasn't been done yet
@raspi
raspi / enable-all-advanced-power-settings.ps1
Last active May 5, 2024 22:24
Enable all advanced power settings in Windows.
# List all possible power config GUIDs in Windows
# Run: this-script.ps1 | Out-File powercfg.ps1
# Then edit and run powercfg.ps1
# (c) Pekka "raspi" Järvinen 2017
$powerSettingTable = Get-WmiObject -Namespace root\cimv2\power -Class Win32_PowerSetting
$powerSettingInSubgroubTable = Get-WmiObject -Namespace root\cimv2\power -Class Win32_PowerSettingInSubgroup
Get-WmiObject -Namespace root\cimv2\power -Class Win32_PowerSettingCapabilities | ForEach-Object {
$tmp = $_.ManagedElement