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
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 { |
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
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); |
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
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 | |
} | |
} |
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 os | |
import requests | |
import rich | |
import rich.console | |
import rich.progress | |
twoHundredMBs=1000*1000*200 | |
console=rich.console.Console() |
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
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) => { |
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
test |