Skip to content

Instantly share code, notes, and snippets.

#include<stdio.h>
#include<stdlib.h>
int loop(int x){
unsigned long a;
unsigned long *ptr;
ptr = &a;
if(x == 0){
return 0;
@pzread
pzread / package.md
Last active August 29, 2015 14:05
Judge Sketch

Compress

The package is compressed in tar.xz format without top directory.

meta.json

{
  pkgid string      //Add by add_pkg API
  apiid string      //Add by add_pkg API, owner id

when int64 //Add by add_pkg API

$.ajax({
'url':'/judge/api/' + api_key + '/add_pkg',
'type':'POST',
'data':pkg,
'cache':false,
'processData':false,
'contentType':false,
'xhr':function(){
var xhr = new XMLHttpRequest();
xhr.upload.addEventListener('progress',function(e){
import re
import requests
from bs4 import BeautifulSoup
def to_bom_utf8(name):
data = open(name, 'rb').read().decode('utf-8')
open(name, 'wb').write(data.encode('utf-8-sig'))
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main() {
char str[100];
char ans[100];
FILE *ansf = fdopen(2, "r");
while(fgets(str, sizeof(str), stdin) != NULL) {
if(fgets(ans, sizeof(ans), ansf) == NULL) {
@pzread
pzread / userscript.js
Last active April 21, 2017 17:39
Mastodon Blocked Contents Loader
// ==UserScript==
// @name Mastodon Blocked Contents Loader
// @namespace http://tampermonkey.net/
// @version 0.1
// @description shows how to use babel compiler
// @author PZ Read
// @require https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.18.2/babel.js
// @require https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.16.0/polyfill.js
// @match https://*/*
// ==/UserScript==
var objs = [];
var bases = [];
let oris = [];
let payloads = [];
for (let i = 0; i < 2; i++) {
objs.push([0x00010000]);
bases.push([0, 1]);
oris.push([100, 100, 100]);
payloads.push([0]);
use std::collections::HashMap;
use std::mem;
struct Link {
pub value: String,
next: *const Link,
}
impl Link {
fn new(value: String, next: *const Self) -> Self {
set ai
set backspace=2
set cin
set et
set hidden
set mouse=
set nocompatible
set nu
set shiftwidth=2
set softtabstop=2
@pzread
pzread / textile.md
Last active October 22, 2022 13:13

天衣無縫 ~ Fantastic Seamless Textile ~

When executing a ELF binary, Linux kernel will pass the memory address of PHDR(program header) to userspace by AT_PHDR entry of AUXV.

ld.so interpreter will parse the PHDR structure at memory addressAT_PHDR and resolve more ELF structures, such as dynamic section.

But Linux kernel wrongly calculate the PHDR address in memory.

NEW_AUX_ENT(AT_PHDR, load_addr + exec->e_phoff);