Skip to content

Instantly share code, notes, and snippets.

View AngelOnFira's full-sized avatar
🥞
Working on cool stuff

Forest Anderson AngelOnFira

🥞
Working on cool stuff
View GitHub Profile
https://www.youtube.com/watch?v=s2Vdje_uPX4
@AngelOnFira
AngelOnFira / geiger
Created August 31, 2022 15:18
Geiger breakdown of Warp web framework
Metric output format: x/y
x = unsafe code used by the build
y = total unsafe code found in the crate
Symbols:
🔒 = No `unsafe` usage found, declares #![forbid(unsafe_code)]
❓ = No `unsafe` usage found, missing #![forbid(unsafe_code)]
☢️ = `unsafe` usage found
Functions Expressions Impls Traits Methods Dependency
use std::{
cmp::Ordering,
collections::{HashMap, HashSet},
};
fn main() {
let input = r#"Tristram to AlphaCentauri = 34
Tristram to Snowdin = 100
Tristram to Tambi = 63
Tristram to Faerun = 108
use std::{
collections::{HashMap, HashSet},
fs,
};
use graphql_parser::{
parse_schema,
schema::{Definition, TypeDefinition},
};
@AngelOnFira
AngelOnFira / rm.txt
Created February 11, 2022 13:07
Regex to remove comments from graphql schema
^\s*"""\n.*\n\s*"""
pub fn draw(tick: u64) -> TreeCanvas {
let mut canvas = TreeCanvas::new();
let l=tick as usize;let o=(2,((tick as f32*0.25).sin().abs()*48.0) as usize);for y in 0usize..75 {for z in
0usize..20{let x=(((z as f32-10.0)/(1.0+y as f32*0.05))+10.0)as usize;let r=(x.wrapping_sub(o.0),y.wrapping_sub(o.1
));let c=if let Some(i)=(r.0<16&&r.1<14).then(||([0x124900dbu64,0x9249249b,0x16d6cb092,0xaeb6cb6d2,0xaed6d96da,
0xb5b6c9250,0x1b6db690,0x6da494494480,0x6da492892805,0x92924d25,0x249a4925,0xb64924925,0x5b64924000,0x5a00000000][
13-r.1]>>(45-r.0*3))as usize&7).filter(|i|i>&0){[!0,0,0xFF0000,0xFF8060,0x80FF,0x805030,!0-0xFF][i]}else if y<6{
0x5030+((l*2+x)%5==0||y%5==0)as u32*0xFF0000}else if((l/2+x)as i32%32-16).pow(2)+(y as i32-55+(((l+x)as f32*0.07)
.sin()*16.0)as i32).pow(2)<24{0xFFFFFF}else if(y as f32)<((l+x)as f32*0.1).sin().abs()*16.0+10.0{0x207010}else{
@AngelOnFira
AngelOnFira / yew-0-19-tutorial.rs
Created December 22, 2021 19:44
The code from the Yew 0.19 tutorial all in one file
use reqwasm::http::Request;
use serde::Deserialize;
use yew::prelude::*;
fn main() {
yew::start_app::<App>();
}
#[derive(Clone, PartialEq, Deserialize)]
struct Video {
@AngelOnFira
AngelOnFira / drunken_bishop_ascii.rs
Created August 8, 2021 00:47
[EFFICITENT] [NOT CLICKBAIT] [PROVEN INNO] Drunken bishop algorithm from https://www.jfurness.uk/the-drunken-bishop-algorithm/
use std::{collections::HashMap, thread, time};
fn main() {
let char_map = " .o+=*B0X@%&#/^".to_string();
// Couldn't figure out how to change hex to binary
let text = "00001011010111100010001110011100010101000100000000001100010010001011001010001010100001111111010101100011101000100001111000100100010101100100010111111011111111010010101011111111000110111001011000001110111010101100010100000110010010101111100000110100111010001010100100110101001100101111000010110100101010001001100010101011011110001100000100110010000000000011001001110011011000101100110111010011011011101111010110111010101110011011101011001111001010110101100010000010110010000001000100101101100000110111110111010111111110101101001001011110110111000101001101001111100010101010001110111001101101010010100010111010011010110010000111110111101100110100100010111011010001001001110001001011011111110110100001000101000001111011100101100111000011111111100010010011100011100111111111000000101101000000001110100110100010001110110111101101000001111000011110
pub fn gcd(numbers: Vec<i32>) -> i32 {
let mut lcd = *numbers.iter().max().unwrap();
for i in 0..(numbers.len()) {
let mut x: i32 = lcd;
let mut y: i32 = numbers[i];
lcd = {
while y != 0 {
let temp = x % y;
@AngelOnFira
AngelOnFira / img.py
Created June 1, 2020 21:44
Download Discord CDN files from teh blog
import os
import os.path
import re
import json
import urllib.request
lines = ""
for filename in [f for f in os.listdir("./") if os.path.isfile(f)]:
with open(filename, 'r') as f: # open in readonly mode
for line in f.readlines():