Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
# Script that takes you to some random page
# on the Internet.
# Adapted from: https://lazybea.rs/ils3/
INDIEBLOG=https://indieblog.page/random
OOH=https://ooh.directory/random
FEEDLE=https:/feedle.world/random
@Brandon-Rozek
Brandon-Rozek / ia-save.py
Created December 24, 2022 17:21
Script that takes a URL and requests the Internet Archive to snapshot it.
#!/bin/env python
from argparse import ArgumentParser
from urllib import request
from urllib.parse import urlparse
import sys
parser = ArgumentParser(description="Request Internet Archive to save the site")
parser.add_argument("URL", type=str, help="URL to save")
parser.add_argument("-s", action='store_true', help="Silent. Makes output less verbose")

openpgp4fpr:1623A4C60EF7B422D2C89D5D0610BBE990258018

@Brandon-Rozek
Brandon-Rozek / photos_google_album.py
Created June 12, 2022 22:33
Grab photo information from a Google Photos Album URL (Not maintained)
"""
Tool to grab list of photo information (URLs/etc) of
images in Google Photos album.
Adapted from Matthieu Bessat
https://github.com/lefuturiste/google-photos-album-crawler/blob/f33026d379058912c597d5802296b55b62ed27a4/src/Crawler.php
"""
import json
import re
import sys
from http.client import HTTPResponse
@Brandon-Rozek
Brandon-Rozek / theme_browser.R
Created May 15, 2021 00:03
R Script to showcase different themes using sample data in a shiny app
library(shiny)
library(dplyr)
library(ggplot2)
library(GGally)
library(ggthemr)
library(gapminder)
gapminder_mediangdp = gapminder %>%
group_by(year, continent) %>%
summarize(medianGdp = median(gdpPercap))
@Brandon-Rozek
Brandon-Rozek / recursionCalculator.js
Created May 15, 2021 00:00
Different arithmetic calculations represented as tail recursions
// Addition & subtraction are independent implementations
var add = function(x, y) {
if (y == 0) {
return x;
}
if (y < 0) {
return add(x - 1, y + 1);
}
return add(x + 1, y - 1);
}
@Brandon-Rozek
Brandon-Rozek / approxPi.go
Created May 14, 2021 23:56
Approximation of Pi using Go
package main
import (
"fmt"
"math"
"math/rand"
"time"
)
// Returns the number of successes, to approx pi use formula
@Brandon-Rozek
Brandon-Rozek / generatePrime.c
Created May 14, 2021 23:43
C code to generate prime numbers
#include <stdio.h>
#include <math.h>
int isPrime(unsigned long long n);
int main() {
printf("%d", 2);
unsigned long long i = 3;
while (1) {
if (isPrime(i)) {
var decay = function(initial, chance) {
var numDecayed = 0;
for (var i = 0; i < initial; i++) {
if (Math.random() < chance) {
numDecayed++
}
}
return numDecayed;
}
@Brandon-Rozek
Brandon-Rozek / MonteCristo.c
Created May 14, 2021 23:14
Monte Cristo Simulation
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
//Amount of times for simulation to run
#define N 5000000
//The amount of times per simulation
#define R 1
//The amount of choices
#define C 4