Skip to content

Instantly share code, notes, and snippets.

from matplotlib import pyplot as plt
import random
import math
n = 10
iters = list(range(200))
ls = sorted([0] + [random.uniform(0, 1) for _ in range(n-1)] + [1])
cls = [i*(1/n) for i in range(n+1)]
@v1nam
v1nam / metaballs.cpp
Created January 30, 2022 03:18
2d metaballs with fragment shader
#include "raylib.h"
#include "rlgl.h"
#include <cmath>
struct Circle
{
int radius;
float posX;
float posY;
@v1nam
v1nam / car.py
Created February 28, 2021 12:40
a terminal ascii animation which animates a moving car in python
import os
import time
car = """
______
/|_||_\`.__
( _ _ _\\
=`-(_)--(_)-'"""
@v1nam
v1nam / luhn_algorithm.rs
Created February 16, 2021 08:33
rust script to validate credit card numbers using the luhn algorithm
use std::io;
fn main() {
let mut number = String::new();
io::stdin()
.read_line(&mut number)
.expect("Failed to get input");
let mut steps: Vec<usize> = Vec::new();
let mut other_nums: Vec<usize> = Vec::new();
@v1nam
v1nam / chinese_remainder.rs
Created February 11, 2021 11:27
A rust script which applies the chinese remainder theorem
use std::io;
use std::collections::HashMap;
fn main() {
let mut values: HashMap<usize, usize> = HashMap::new();
println!("Please enter the values in the format `b mod n`");
println!("Enter `q` to break");
loop {
let mut statement = String::new();
@v1nam
v1nam / nerdicon.py
Created January 26, 2021 12:10
Python script to search for nerdfont icons from the terminal
import requests
from bs4 import BeautifulSoup
req = requests.get("https://www.nerdfonts.com/cheat-sheet")
soup = BeautifulSoup(req.content, "html.parser")
def main(icon):
icon_html = soup.find_all(id="glyphCheatSheet")
icon_html = icon_html[0]
icons = []