Skip to content

Instantly share code, notes, and snippets.

View udoprog's full-sized avatar

John-John Tedro udoprog

View GitHub Profile
@udoprog
udoprog / config.toml
Created June 17, 2023 22:59
Example config.toml for oxidize web
database = "db"
base_url = "https://setbac.tv"
[session]
secret = "RANDOM_DATA"
[oauth2]
redirect_path = "api/auth/redirect"
[oauth2.login]
@udoprog
udoprog / yts.js
Last active February 12, 2023 13:27
Modify YouTube Shorts
// ==UserScript==
// @name Youtube Shorts
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Modify the visiblity of Youtube Shorts
// @author John-John Tedro <udoprog@tedro.se>
// @match https://www.youtube.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @grant GM_registerMenuCommand
// @grant GM_setValue
--- a.txt 2022-12-07 14:31:31.870270000 +0100
+++ b.txt 2022-12-07 14:31:58.517728400 +0100
@@ -16,34 +16,40 @@
.zero 1
.zero 1
.LCPI0_1:
- .long 2147483648
- .long 2147483648
- .long 2147483648
- .long 2147483648
use std::path::Path;
use anyhow::{Context, Result};
use thiserror::Error;
#[derive(Debug, Error)]
enum Error {
#[error("{0}:{1}:{2}: expected more input")]
Expected(Box<Path>, usize, usize),
#[error("{0}:{1}:{2}: bad input")]
@udoprog
udoprog / linked_list.rs
Created April 11, 2021 03:18
An intrusive linked list in Rust
//! An intrusive linked list.
use std::ptr;
/// A node in the intrusive [LinkedList].
pub struct Node<T> {
next: Option<ptr::NonNull<Node<T>>>,
prev: Option<ptr::NonNull<Node<T>>>,
pub value: T,
}
@udoprog
udoprog / gist:02d0c4ec916f281f13b12183f01a1334
Created September 22, 2020 02:11
Error when using Vm::send_execute wrong
cargo : Compiling rune v0.6.16 (D:\Repo\rune\crates\rune)
At line:1 char:1
+ cargo run --example tokio_spawn 2> out.txt
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: ( Compiling ru...ne\crates\rune):String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
error[E0277]: `std::ptr::NonNull<runestick::shared::SharedBox<std::string::String>>` cannot be sent between threads safely
--> crates\rune\examples\tokio_spawn.rs:15:32
|
state("ModernWarfare")
{
string64 map : 0xB0A1E08;
// Need to use this pointer instead of the address available in modules since
// this changes correctly regardless of how you save/load.
string64 checkpoint : 0xB297DB8, 0x20, 0x108;
// shit the bed on hometown and forward.
// bool missiontext : 0xB2E6B94;
bool missiontext : 0xE7A70DC;
bool prompts : 0xB2E5EA4;
state("ModernWarfare")
{
string255 map : 0xAE9E980;
string255 checkpoint : 0x11821030;
bool cinematics : 0xD9D3110;
}
startup {
settings.Add("proxywar", true, "Fog Of War");
settings.Add("piccadilly", true, "Piccadilly");
use futures::Future;
use warp::Filter;
#[tokio::main]
async fn main() {
let r1 = warp::path("index").and_then(route1);
let r2 = warp::path::param().and_then(route2);
let routes = r1.recover(recover).or(r2.recover(recover));
@udoprog
udoprog / varint.rs
Created September 22, 2019 19:37
Just a simple variable-length encoding for integers I threw together
use std::io::{self, Read, Write};
trait Encoder: Sized {
fn encode<W>(self, writer: &mut W) -> io::Result<()>
where
W: Write;
fn decode<R>(reader: &mut R) -> io::Result<Self>
where
R: Read;
}