This file contains hidden or 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
""" | |
Problem: | |
Given an immutable tree (where each node is identified by a unique ID and contains a list of children), | |
write a function to process queries that ask for the n-th parent (iteratively climbing upwards) of a node. | |
Preprocessing is allowed (in below code, all lines that are used to populating cache are considered as preprocessing), | |
want fastest average query time, allow some space complexity. | |
Time complexity: O(log(n)) | |
Space complexity: O(n*log(n)) | |
""" |
This file contains hidden or 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
{ | |
inputs = { | |
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; | |
parts.url = "github:hercules-ci/flake-parts"; | |
nixgl.url = "github:nix-community/nixgl"; | |
}; | |
outputs = inputs @ { self, nixpkgs, parts, nixgl }: parts.lib.mkFlake { inherit inputs; } { | |
systems = [ "aarch64-darwin" "x86_64-darwin" "x86_64-linux" ]; |
This file contains hidden or 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 argparse | |
import csv | |
import gzip | |
import urllib.request | |
def main() -> None: | |
parser = argparse.ArgumentParser() | |
parser.add_argument("file", type=argparse.FileType("r")) | |
parser.add_argument("auth", type=str) |
This file contains hidden or 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 "@preview/polylux:0.3.1": * | |
#import themes.simple: * | |
#import logic | |
#let simple-footer = state("simple-footer", []) | |
#let simple-theme( | |
aspect-ratio: "16-9", | |
footer: [], | |
background: white, |
This file contains hidden or 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
let | |
nixbuildDomain = "eu.nixbuild.net"; | |
nixbuildKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPIQCZc54poJ8vqawd8TraNryQeJnvH1eLpIDgbiqymM"; | |
nixbuildPlatforms = [ "x86_64-linux" "aarch64-linux" ]; | |
nixbuildFeatures = [ "big-parallel" "benchmark" "kvm" "nixos-test" ]; | |
nixbuildSSH = '' | |
Host eu.nixbuild.net | |
PubkeyAcceptedKeyTypes ssh-ed25519 | |
ServerAliveInterval 60 | |
IPQoS throughput |
This file contains hidden or 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 bash | |
# More info at: https://github.com/elitak/nixos-infect | |
set -e -o pipefail | |
makeConf() { | |
# Skip everything if main config already present | |
[[ -e /etc/nixos/configuration.nix ]] && return 0 |
This file contains hidden or 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 plistlib | |
import requests | |
from urllib.request import urlretrieve | |
def xml(url: str) -> list[str]: | |
result = [] |
This file contains hidden or 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 | |
set -exuo pipefail | |
git clone --depth 1 https://github.com/nimble-code/spin.git ~/.spin | |
pushd ~/.spin | |
make | |
ln -fsv ~/.spin/Src/spin /usr/local/bin/spin |
This file contains hidden or 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 | |
set -exuo pipefail | |
ffmpeg \ | |
-v debug \ | |
-headers $'Connection: Keep-Alive\r\n' \ | |
-headers $'User-Agent: <user agent>\r\n' \ | |
-headers $'Cookie: key1=value1; key2=value2\r\n' \ | |
-i 'https://<target m3u8 URL>' \ |