Skip to content

Instantly share code, notes, and snippets.

View zjuchenyuan's full-sized avatar

ChenYuan zjuchenyuan

View GitHub Profile
@yorickdowne
yorickdowne / HallOfBlame.md
Last active April 19, 2024 17:03
Great and less great SSDs for Ethereum nodes

Overview

Syncing an Ethereum node is largely reliant on IOPS, I/O Per Second. Budget SSDs will struggle to an extent, and some won't be able to sync at all.

This document aims to snapshot some known good and known bad models.

For size, 4TB or 2TB come recommended as of mid 2024. A 2TB drive should last an Ethereum full node until late 2025 or thereabouts, with crystal ball uncertainty.

High-level, QLC and DRAMless are far slower than "mainstream" SSDs. QLC has lower endurance as well. Any savings will be gone when the drive fails early and needs to be replaced.

@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active April 17, 2024 01:21
Hyperlinks in Terminal Emulators
@UniIsland
UniIsland / SimpleHTTPServerWithUpload.py
Created August 14, 2012 04:01
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.
"""
@ipbastola
ipbastola / clean-up-boot-partition-ubuntu.md
Last active April 3, 2024 06:54
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
@magisterquis
magisterquis / demoshell.go
Last active April 1, 2024 12:12
Beaconing shell, useful for demos. Catch it with netcat.
// demoshell is a nifty beaconing shell useful for demos
package main
/*
* demoshell.go
* Simple reverse shell used in demos
* By J. Stuart McMurray
* Created 20180331
* Last Modified 20180331
*/
@gubatron
gubatron / multiple-deploy-keys-multiple-private-repos-github-ssh-config.md
Last active March 12, 2024 07:34
How to configure multiple deploy keys for different private github repositories on the same computer without using ssh-agent

How to configure multiple deploy keys for different private github repositories on the same computer without using ssh-agent

Let's say alice is a github.com user, with 2 or more private repositories repoN. For this example we'll work with just two repositories named repo1 and repo2

https://github.com/alice/repo1

https://github.com/alice/repo2

You need to be to pull from these repositories without entering a passwords probably on a server, or on multiple servers.

@mkornatz
mkornatz / cf-worker.js
Last active March 7, 2024 11:02
Cloudflare Workers CORS Proxy (supports websockets)
// We support the GET, POST, HEAD, and OPTIONS methods from any origin,
// and allow any header on requests. These headers must be present
// on all responses to all CORS preflight requests. In practice, this means
// all responses to OPTIONS requests.
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET,HEAD,POST,OPTIONS",
"Access-Control-Max-Age": "86400",
}
@christianroman
christianroman / test.py
Created May 30, 2013 16:02
Bypass Captcha using 10 lines of code with Python, OpenCV & Tesseract OCR engine
import cv2.cv as cv
import tesseract
gray = cv.LoadImage('captcha.jpeg', cv.CV_LOAD_IMAGE_GRAYSCALE)
cv.Threshold(gray, gray, 231, 255, cv.CV_THRESH_BINARY)
api = tesseract.TessBaseAPI()
api.Init(".","eng",tesseract.OEM_DEFAULT)
api.SetVariable("tessedit_char_whitelist", "0123456789abcdefghijklmnopqrstuvwxyz")
api.SetPageSegMode(tesseract.PSM_SINGLE_WORD)
tesseract.SetCvImage(gray,api)
print api.GetUTF8Text()
@quark-zju
quark-zju / gdb-trace.py
Last active December 31, 2023 14:14
Trace all function calls using gdb
#!/usr/bin/env python
try:
import gdb
inside_gdb = True
except ImportError:
inside_gdb = False
if inside_gdb:

Exploiting Lua 5.1 on 32-bit Windows

The following Lua program generates a Lua bytecode program called ignore-unsigned-sga.fnt, which in turn loads a DLL from within an extremely locked down Lua 5.1 sandbox in a program called RelicCOH2.exe. The remainder of this document attempts to explain how this program works by a whirlwind tour of relevent bits of the Lua 5.1 virtual machine.

if string.dump(function()end):sub(1, 12) ~= "\27Lua\81\0\1\4\4\4\8\0" then
  error("This generator requires a 32-bit version of Lua 5.1")
end

local function outer()
  local magic -- In bytecode, the stack slot corresponding to this local is changed