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 is some text that might be a makefile or something |
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
// A generic quicksort algorithm implementation in rust | |
fn quicksort<T: Eq + PartialEq + Clone + PartialOrd>(arr: &mut Vec<T>, low: usize, high: usize) { | |
if low < high { | |
let p = partition(arr, low, high, &|a, b| {a <= b}); | |
quicksort(arr, low, p-1); | |
quicksort(arr, p+1, high); | |
} | |
} | |
fn partition<T: Clone, F: Fn(&T, &T) -> bool>(arr: &mut Vec<T>, low: usize, high: usize, f: &F) -> usize { |
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
""" Scatter.py, scatter your files to the four corners of the wind. """ | |
import os | |
import random | |
import tarfile | |
def mktarball(file_path, delete=False): | |
""" Create a tarball from file_path, optionally deleting the | |
original. """ | |
file_dir = os.path.dirname(file_path) | |
file_name = os.path.basename(file_path) |
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
''' Control and run RGB Fedora server. ''' | |
# Asynchronous loop code | |
import uasyncio as asyncio | |
# Controlling RGB strip | |
import neopixel | |
# Controlling pin out | |
import machine | |
# Connecting to Wireless Network | |
import network | |
# Communicating over sockets |
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
#!/usr/bin/env python3 | |
import json | |
import sys | |
import subprocess | |
def stop_running_task(): | |
subprocess.run(['timetrap', 'out']) |
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 value_of(knapsack, configuration): | |
values = zip(knapsack, configuration) | |
return sum(value for value, stolen in values | |
if stolen is True) | |
def combinations_of(length): | |
lst = [False] * length | |
for i in range(2 ** length): | |
for j in range(len(lst)): |
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 collections import namedtuple | |
import xml.etree.ElementTree as et | |
import requests | |
import sys | |
from pathlib import Path | |
Song = namedtuple('Song', ['title', 'filename', 'url', 'size']) | |
RSS_URL = 'http://musicforprogramming.net/rss.php' |
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 | |
from collections import deque | |
with open('words.txt') as infile: | |
WORDS = [l.strip() for l in infile] | |
def nice_hash(val): | |
value = ord(val[0]) << 7 | |
for char in val: | |
value = ((1000003 * value) & 0xFFFFFFFF) ^ ord(char) |
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
#!/usr/bin/env racket | |
#lang racket | |
(require (for-syntax racket/format)) | |
(require racket/date) | |
(define-syntax (bar-definitions bar) | |
(syntax-case bar () | |
[(_ forms ...) | |
#`(begin |
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 | |
from collections import deque | |
from enum import Enum | |
from functools import total_ordering | |
import heapq | |
import math | |
import itertools | |
with open('words.txt') as infile: | |
WORDS = [l.strip() for l in infile] |
OlderNewer