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 | |
# get the directory that this script is in so you can call it from anywhere | |
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | |
# your output folder, where sub0MyAgent.py.zip will be placed | |
# TODO: EDIT | |
out_dir="$script_dir/submissions/latest" | |
# locations of your files |
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
unload_files=( | |
"/Library/LaunchAgents/com.tuxera.ntfs.agent.plist" | |
) | |
for unload_file in "${unload_files[@]}"; do | |
echo "Unloading: ${unload_file}" | |
launchctl unload "${unload_file}" | |
echo | |
done |
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 imageio | |
import numpy as np | |
import sys | |
import os | |
import imagesize | |
if __name__ == '__main__': | |
assert len(sys.argv) >= 2, 'must supply at least 1 file argument' |
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
def torch_pca_svd(X, center=True): | |
n, _ = X.shape | |
# center points along axes | |
if center: | |
X = X - X.mean(dim=0) | |
# perform singular value decomposition | |
u, s, v = torch.svd(X) | |
# extract components | |
components = v.T | |
explained_variance = torch.mul(s, s) / (n-1) |
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 | |
# TPS corresponds to IOPS: | |
# https://en.wikipedia.org/wiki/IOPS | |
function cluster-disk-info() { | |
folders="/tmp /home-mscluster/ /scratch" | |
# disk space | |
df -h -P $folders | |
disks=$(df -h -P $folders | perl -n -e '/.*.dev.(...).*/ && print "$1 "') |
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
# ~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ | |
# MIT License | |
# | |
# Copyright (c) 2021 Nathan Juraj Michlo | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is |
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
@functools.lru_cache() | |
def dither_matrix(n: int): | |
assert isinstance(n, int) and (n > 0) | |
if n == 1: | |
return np.array([[0]]) | |
matrix = (1/n**2) * np.asarray(np.bmat([ | |
[n**2 * dither_matrix(int(n/2)) + 0, n**2 * dither_matrix(int(n/2)) + 2], | |
[n**2 * dither_matrix(int(n/2)) + 3, n**2 * dither_matrix(int(n/2)) + 1], | |
])) | |
matrix.flags.writeable = False # because we are caching this |
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
from functools import lru_cache | |
from typing import Tuple | |
from typing import Union | |
import numpy as np | |
import torch | |
# ========================================================================= # |
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 dataclasses | |
import inspect | |
from functools import lru_cache | |
from typing import Any | |
from typing import Dict | |
from typing import Set | |
from typing import Tuple | |
from typing import Union |
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
# Copyright (c) 2020 Nathan Juraj Michlo | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# | |
# The above copyright notice and this permission notice shall be included in all |
OlderNewer