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
from math import factorial | |
from operator import add | |
from itertools import count | |
def R(n): | |
return reduce(add, map(int, str(factorial(n)))) | |
if __name__ == "__main__": | |
#Brute force works just fine on my makbook air so... | |
for n in count(): |
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
from HTMLParser import HTMLParser | |
from operator import add | |
from math import sqrt, pow | |
import requests | |
class EmbedlyParser(HTMLParser): | |
depth = 1 | |
ps = [] | |
article = False |
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
from operator import add | |
if __name__ == "__main__": | |
most_frequent = 2520 | |
freq_list = [most_frequent/n for n in xrange(1, 901)] | |
total_w = reduce(add, freq_list) | |
half = total_w/2 | |
cnt = 0 | |
for i, f in enumerate(freq_list, start = 1): | |
cnt+=f |
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 gc | |
import os | |
import requests | |
import subprocess | |
import sys | |
class request_maker(object): | |
def __init__(self): | |
self.s = requests.Session() | |
def make(self): |
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 random | |
import time | |
import uuid | |
if __name__ == "__main__": | |
# 1k instance per host on the heavy side | |
uuid_list = [str(uuid.uuid4()) for x in xrange(1000)] | |
# 100 claims also on the heavy side | |
uuids_to_check = [str(uuid.uuid4()) for x in xrange(100)] |
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 | |
# A script to run tests using khaleesi | |
# Usage: | |
# | |
# Run tests using a RHOS 7/RHEL 7 environment | |
# ./tools/khaleesi.sh | |
# | |
# Run tests using a RHOS 5/RHEL 7 environment |
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 heapq | |
import sys | |
class LogFile(object): | |
def __init__(self, filename): | |
self.filename = filename | |
self.f = open(filename) | |
self.sort_field = self.line = None | |
self.done = False |
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::error::Error; | |
use combinations::Combinations; | |
use std::io::{self, Read}; | |
fn main() -> Result<(), Box<dyn Error>> { | |
let mut buffer = String::new(); | |
io::stdin().read_to_string(&mut buffer)?; | |
let expenses = buffer | |
.trim_end() | |
.split("\n") |
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::error::Error; | |
use std::io::{self, Read}; | |
#[derive(Debug)] | |
struct Departure { | |
id: u64, | |
wait: u64, | |
} | |
impl Departure { |