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 pandas as pd | |
import re | |
space_splitter = re.compile("\s+") | |
regex = re.compile("\s*(.*)\s*>\s*(.*?):\s.*") | |
def parse_line(line): | |
try: | |
elements = space_splitter.split(line) | |
source_dest = regex.match(" ".join(elements[4:])).groups() |
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 | |
function iniget() { | |
if [[ $# -lt 2 || ! -f $1 ]]; then | |
echo "usage: iniget <file> [--list|<section> [key]]" | |
return 1 | |
fi | |
local inifile=$1 | |
if [[ "$2" == "--list" ]]; then |
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 typing import Any, Tuple, Dict | |
import networkx as nx | |
import numpy as np | |
def generate_Xmas_tree(depth: int) -> nx.Graph: | |
nodes = set(range(sum(i for i in range(depth+1)))) | |
# Create the tree |