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
This app was not programmed to send any data off-device. We will not collect nor share anything about you. |
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
# conversation from twitter: https://twitter.com/driscollis/status/1475571532898385927 | |
# This function's worst case performance is n*log(n) | |
def find_most_common_number_in_list(number_list): | |
# O(n*log(n))) | |
counts = {} | |
for number in number_list: | |
try: | |
counts[number] += 1 | |
except: |
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
# https://arxiv.org/pdf/1909.10140.pdf | |
from random import shuffle | |
from math import sin | |
def xicor_integrated(X, Y): | |
# sort Y based on X | |
new_vars = [] |
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
def one_way_distance(string_a, string_b) | |
score = 0 | |
against = 0 | |
(0..string_a.size-1).each do |idx| | |
(idx..string_a.size-1).each do |len| | |
if !string_b.index(string_a[idx, len-idx+1], 0).nil? | |
score += (len-idx+1)*2 | |
else | |
against += 1 | |
end |
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
"""This class provides a way to access to most up-to-date version of a file without reading the whole file from the harddrive. | |
It does this by first reading when the file was last updated from the filesystem and only reads the whole file if the | |
file has been updated since. This is more useful for large files and works because RAM has faster access than the harddrive.""" | |
from datetime import datetime | |
import os | |
class CachedFile: |
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 json | |
def add_table(name, json, exclude=None): | |
non_array_columns = [key for key in json if not isinstance( | |
json[key], list) and key != exclude] | |
id_column = prompt_for_selection(non_array_columns, name) | |
non_array_columns = [x for x in non_array_columns if x != id_column] | |
array_values = [key for key in json if isinstance( | |
json[key], list) and key != id_column and key != exclude] |
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
//[dependencies] | |
//rusqlite = "0.24.0" | |
use std::env; | |
use rusqlite::{params, Connection}; | |
use std::process; | |
struct Prime { | |
id: i64, | |
} |
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
use std::env; | |
//"./fuzzy andrew andy" should yield 0.91588783 | |
fn main() { | |
let args: Vec<String> = env::args().collect(); | |
let arg1 = &args[1]; | |
let arg2 = &args[2]; | |
println!("{}", fuzzy(arg1.to_string(), arg2.to_string())); | |
} |
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 <string.h> | |
void substring(const char [], char[], int, int); | |
float fuzzy_string(const char* a, const char* b) { | |
int reward = 0; | |
int penalty = 0; | |
int len_a = 0; | |
while (a[len_a] != '\0') len_a++; |
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/bash | |
echo "App Release Automator by @rodydavis" | |
action="$1" | |
red=`tput setaf 1` | |
green=`tput setaf 2` | |
reset=`tput sgr0` | |
if [ ${action} = "build" ]; then |
NewerOlder