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
function find_and_activate_venv() { | |
current_dir=$PWD | |
while [ "$current_dir" != "/" ]; do | |
if [ -d "$current_dir/.venv" ]; then | |
source "$current_dir/.venv/bin/activate" | |
return | |
fi | |
current_dir=$(dirname "$current_dir") | |
done |
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
#!/usr/bin/env python3 | |
import argparse | |
import json | |
import sys | |
def jq_filters(d, path=None, text_limit=None): | |
""" | |
Returns all jq filters for the json. | |
""" |
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 os | |
import json | |
import logging | |
from urllib import request | |
from datetime import datetime, timezone | |
from dataclasses import dataclass | |
import boto3 | |
from boto3.dynamodb.conditions import Key |
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 | |
from queue import PriorityQueue | |
from dataclasses import dataclass | |
from functools import cache | |
grid = pd.read_csv("./data/17.txt", names=[0], dtype='str').apply(lambda x: pd.Series(list(x[0])), axis=1).astype(int) | |
directions = [(0, 1), (1, 0), (-1, 0), (0, -1)] | |
@dataclass(frozen=True, order=True) | |
class NodeState: |
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 asyncio | |
import websockets | |
async def client_to_server(client, server): | |
async for message in client: | |
await server.send(message) | |
async def server_to_client(client, server): | |
async for message in server: |
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
Docker Image : pytorch/pytorch | |
Image Runtype : jupyter_direc ssh_direc ssh_proxy | |
Environment : [["JUPYTER_DIR", "/"], ["-p 41654:41654", "1"]] | |
pip install torch bitsandbytes sentencepiece "protobuf<=3.20.2" git+https://github.com/huggingface/transformers flask python-dotenv Flask-HTTPAuth accelerate | |
!mv /opt/conda/lib/python3.10/site-packages/bitsandbytes/libbitsandbytes_cuda116.so /opt/conda/lib/python3.10/site-packages/bitsandbytes/libbitsandbytes_cpu.so |
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
#!/usr/bin/env python3 | |
import psutil | |
import time | |
if __name__ == "__main__": | |
while True: | |
procs = [] | |
for proc in psutil.process_iter(): |
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
#!/usr/bin/env python3 | |
import os | |
import openai | |
import argparse | |
import sys | |
openai.api_key = os.getenv("OPENAI_API_KEY") | |
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 pickle | |
from datetime import datetime, timedelta | |
from functools import wraps | |
from hashlib import sha224 | |
from pathlib import Path | |
from time import time | |
from typing import Optional | |
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
package main | |
import ( | |
"fmt" | |
"math" | |
"sort" | |
"time" | |
) | |
// Data holds Value & Time when value was observed |
NewerOlder