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 signal | |
| from contextlib import contextmanager | |
| from time import perf_counter | |
| @contextmanager | |
| def timeout(duration: int): | |
| def timeout_handler(signum, frame): | |
| raise Exception(f"Block timed out after {duration} seconds") |
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 json | |
| from collections import deque | |
| from functools import wraps | |
| from pprint import pformat | |
| from time import time | |
| from typing import List | |
| from typing import Text | |
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 asyncio | |
| import requests | |
| import numpy as np | |
| import time | |
| from functools import wraps | |
| from typing import Callable | |
| REQUEST_BATCH_SIZE = 250 |
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
| projects=$(atlas projects list | jq -cr '.results[] | {id, name} | select(.name!="test-gpu-261023")') | |
| for row in $projects; do | |
| projectId=$(echo $row | jq -r '.id') | |
| projectName=$(echo $row | jq -r '.name') | |
| echo "Deleting serverless instance: $projectName (ID: $projectId)" | |
| atlas serverless delete $projectName --projectId $projectId | |
| done | |
| for row in $projects; do |
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 click | |
| import json | |
| import requests | |
| import sys | |
| import time | |
| import pandas as pd | |
| from tqdm.auto import tqdm | |
| from rich.progress import track | |
| from rich.console import Console |
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
| # Encode audo to acc - keep video stream as it is | |
| ffmpeg -i <inut-video>.mp4 -c:v copy -codec:a aac <output-video>.mp4 |
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 | |
| say() { | |
| echo "$@" | sed \ | |
| -e "s/\(\(@\(red\|green\|yellow\|blue\|magenta\|cyan\|white\|reset\|b\|u\)\)\+\)[[]\{2\}\(.*\)[]]\{2\}/\1\4@reset/g" \ | |
| -e "s/@red/$(tput setaf 1)/g" \ | |
| -e "s/@green/$(tput setaf 2)/g" \ | |
| -e "s/@yellow/$(tput setaf 3)/g" \ | |
| -e "s/@blue/$(tput setaf 4)/g" \ | |
| -e "s/@magenta/$(tput setaf 5)/g" \ |
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 | |
| # Cron doesn't have access to env.vars as your user has, | |
| # so we need to export these: | |
| export TERM=xterm-256color | |
| # Check current value with: 'echo $DBUS_SESSION_BUS_ADDRESS' and paste here | |
| # see: https://stackoverflow.com/questions/53628122/git-libsecret-throws-cannot-autolaunch-d-bus-without-x11-display | |
| export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus | |
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/questions/39928401/recover-db-password-stored-in-my-dbeaver-connection | |
| # requires pycrypto lib (pip install pycrypto) | |
| import sys | |
| import base64 | |
| import os | |
| import json | |
| from Crypto.Cipher import AES |
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
| # increase history limit to 90K lines | |
| set-option -g history-limit 90000 | |
| # Enable mouse mode | |
| set -g mouse on | |
| # remap keys for copy-mode | |
| # bind -t vi-copy y copy-pipe "xclip -sel clip -i" | |
| setw -g mode-keys vi |