openpgp4fpr:5F37830BFA46FF7881F47AC78DF79C3DC5FC658A
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
#!/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") |
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
""" | |
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 |
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
library(shiny) | |
library(dplyr) | |
library(ggplot2) | |
library(GGally) | |
library(ggthemr) | |
library(gapminder) | |
gapminder_mediangdp = gapminder %>% | |
group_by(year, continent) %>% | |
summarize(medianGdp = median(gdpPercap)) |
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
// 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); | |
} |
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
package main | |
import ( | |
"fmt" | |
"math" | |
"math/rand" | |
"time" | |
) | |
// Returns the number of successes, to approx pi use formula |
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
#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)) { |
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
var decay = function(initial, chance) { | |
var numDecayed = 0; | |
for (var i = 0; i < initial; i++) { | |
if (Math.random() < chance) { | |
numDecayed++ | |
} | |
} | |
return numDecayed; | |
} |
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
#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 |
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 numpy as np | |
class SymmetricElement: | |
def __init__(self, *args): | |
self.data = np.array(list(args), dtype=np.int64) | |
# Confirm that there is at least one mapping | |
assert len(self.data) > 0 | |
# Check bijective | |
assert len(np.unique(self.data)) == len(self) | |
# Check that range is between 1-length |