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
# Define the pipeline (this step uploads required code and packages by the pipeline to S3) | |
pipeline = pipeline_factory.create( | |
pipeline_name=pipeline_name, | |
role=sm_execution_role_arn, | |
sm_session=sagemaker_session, | |
) | |
pipeline_def_json = json.dumps(json.loads(pipeline.definition()), indent=2, sort_keys=True) |
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
# Usage: | |
# Install needed tmp packages | |
# pactmp -S junk package | |
# Remove the packages when not needed anymore | |
# pactmp -R | |
function pactmp() { | |
MODE=$1; shift | |
if [[ "$MODE" == "-S" ]]; then | |
sudo pacman -S $@; echo $@ >> ~/.pactmp | |
else |
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
#@title Load cached dataset from google drive | |
drive_project_root = "MyDrive/Colab" #@param {type:"string"} | |
dataset_name = "stanford40_augmented.tar.gz" #@param {type:"string"} | |
import os | |
from google.colab import drive | |
drive.mount('/content/drive') | |
drive_dataset_path = os.path.join('/content/drive', drive_project_root, dataset_name) | |
!test -e $drive_dataset_path \ |
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
# https://stackoverflow.com/a/59226569 | |
interval = setInterval(function() { | |
console.log("working") | |
var selector = "#top-toolbar > colab-connect-button" | |
document.querySelector(selector).shadowRoot.querySelector("#connect").click() | |
setTimeout(function() { | |
document.querySelector(selector).shadowRoot.querySelector("#connect").click() | |
}, 1000) | |
}, 60*1000) |

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
macro_rules! format_numeric { | |
(($s: expr; $i: expr, $x: ident) -> ($($body:tt)*)) => {format!($s, $($body)* $i)}; | |
(($s: expr; $i: expr, $x: ident, $($y: ident),+) -> ($($body:tt)*)) => {format_numeric!(($s; $i + 1, $($y),+) -> ($($body)* $i,))}; | |
[$s: expr; $($y: ident),+] => { format_numeric!(($s; 1, $($y),+) -> ()) }; | |
} | |
assert_eq!( | |
format_numeric!["{}, {} and {}"; a, b, c], | |
"1, 2 and 3" | |
) |
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 | |
from mutagen import File | |
from mutagen.flac import FLAC | |
from mutagen.easyid3 import EasyID3 | |
import os | |
import shutil | |
from subprocess import call | |
from multiprocessing import Pool |
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 struct import unpack_from | |
class DatabaseReader: | |
def __init__(self, file): | |
self.cursor = 0 | |
self._db = file.read() | |
def read_num(self, length): | |
type_map = {1: 'B', 2: 'H', 4: 'I', 8: 'Q'} |