Skip to content

Instantly share code, notes, and snippets.

@0x24a
0x24a / yarhs.rs
Created July 15, 2024 07:06
Yet Another Rust HTTP Server
use std::{collections::HashMap, io::{BufRead, BufReader, Write, Read}, net::TcpListener, thread};
struct HTTP101Request {
method: String,
path: String,
headers: HashMap<String, String>,
body: Vec<u8>,
}
struct HTTP101Response {
@0x24a
0x24a / main.rs
Created July 14, 2024 14:22
Simple Rust HTTP Fileserver
use std::{io::{BufRead, BufReader, Write}, net::{TcpListener, TcpStream}, fs};
use dict::{ Dict, DictIface};
fn main(){
let listener = TcpListener::bind("127.0.0.1:10086").unwrap();
println!("Listening for HTTP requests on {}", "http://127.0.0.1:10086");
for stream in listener.incoming(){
let stream = stream.unwrap();
println!("Connected with {}!", stream.peer_addr().unwrap());
handle_connection(stream);
@0x24a
0x24a / index.js
Created January 29, 2024 14:52
HC++ Plugin: No-Single-Punctuation-Mark
const punctuation_marks=Array.from(".,?!…,。?!")
function pmcheck(args){
if(args[0].cmd!="chat"){return args};
if((args[0].text.length == 1) || punctuation_marks.indexOf(args[0].text) != -1){
pushMessage({nick:"!",text:"Single punctuation mark cannot be sent."})
return false;
}else{
return args
}
}
@0x24a
0x24a / catbox-segmented-upload.py
Last active June 25, 2024 13:25
Segmented Catbox Uploading Script.
import os
import requests
import rich
import rich.console
import rich.progress
twoHundredMBs=1000*1000*200
console=rich.console.Console()
@0x24a
0x24a / plugin.js
Created August 31, 2023 13:19
HC++ Plugin: Image uploading
function upload_image(url, base64) {
return new Promise((resolve, reject) => {
const socket = new WebSocket(url);
socket.onopen = () => {
const message = JSON.stringify({ data: base64 });
socket.send(message);
};
socket.onmessage = (event) => {
@0x24a
0x24a / test.txt
Created February 18, 2023 12:13
test
test