Skip to content

Instantly share code, notes, and snippets.

View hamidzr's full-sized avatar
🎯
[~/] # ...

Hamid Zare hamidzr

🎯
[~/] # ...
View GitHub Profile
@hamidzr
hamidzr / test-gas-env.py
Last active February 7, 2024 18:35
Examine a machine for running deep learning models
"""
docker pull determinedai/genai-eval:latest &&\
echo "Running checks..."; \
curl -s https://gist.githubusercontent.com/hamidzr/9e327b152885785797cb3dc3c1d4cdfa/raw/test-gas-env.py |\
docker run -i --rm --gpus all --entrypoint /bin/bash determinedai/genai-eval:latest -c "cat > /tmp/test-env.py && python3 /tmp/test-env.py"
# or save it to a file test-env.py and run:
cat test-env.py |\
docker run -i --rm --gpus all --entrypoint /bin/bash determinedai/genai-eval:latest -c "cat > /tmp/test-env.py && python3 /tmp/test-env.py"
"""
@hamidzr
hamidzr / hamid-deployment.md
Last active February 8, 2024 19:14
Deployment Guide and FAQs

Hamid's Deployment Guide

Frequently Asked Questions (FAQs)

Accessing AWS Instances

Q: How do I access any AWS instance?
A: Utilize Amazon SSM to gain access. Navigate to the EC2 instance in the AWS console, select the connect button, and this provides root access to the instance. Optionally, you can add your SSH key for future access.

Updating Master Configuration

Q: How do I update the master config?

@hamidzr
hamidzr / storage-planning.py
Last active July 27, 2023 06:38
plan and calculate how a list of items can fit in a 2d space. 2d binpacking
from typing import NamedTuple, List
from rectpack import newPacker
import argparse
import re
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import dataclasses
Item = NamedTuple("Item", [("name", str), ("width", float), ("depth", float)])
@hamidzr
hamidzr / car-cost.py
Created October 11, 2022 04:26
car cost calculator. Why you neeeed that sweet new ride, numbers edition.
#!/usr/bin/env python3
import numpy_financial as npf
import numpy as np
import typing as t
import json
"""
TODO:
- opportunity cost calc
"""
@hamidzr
hamidzr / wacom.py
Last active October 3, 2022 16:59
Python APIs to configure Wacom tablets, stylus, and pen on Linux. Set ratios and rotations based on a selected area of screen and more.
#!/usr/bin/env python3
from typing import Literal, Union
from py_utils.v1.bash import get_output, run
import dataclasses
import functools
"""
from Arch Linux wiki:
@hamidzr
hamidzr / personal-capital.js
Created September 2, 2021 04:46
export Personal Capital portfolio holdings to CSV
hmd = hmd || {};
if (hmd.download === undefined) {
hmd.download = (filename, text) => {
var element = document.createElement('a');
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
element.setAttribute('download', filename);
element.style.display = 'none';
document.body.appendChild(element);
@hamidzr
hamidzr / chromecast-volume.py
Created September 2, 2021 04:44
set volume on all chromecast devices in your network
#!/usr/bin/env prun
import pychromecast
import sys
import itertools
from typing import List, Dict
services, browser = pychromecast.discovery.discover_chromecasts()
@hamidzr
hamidzr / workrave-parser.py
Last active May 7, 2021 04:21
Parse, merge, and output multiple workrave history usages. https://workrave.org/
#!/usr/bin/env python3
from typing import Any, Dict, List, Union, Optional, cast
import datetime
import os.path
"""
Parse, merge, and output multiple workrave history usages. https://workrave.org/
history file format:
@hamidzr
hamidzr / sof-audio-setup-carbonx1.sh
Last active June 2, 2023 01:43
Lenovo Carbon X1 Gen 7 - Audio and microphone fix - https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_X1_Carbon_(Gen_7) might be all you need.
#!/bin/bash
# README You probablyl don't need this script anymore. Please read the comments below to catch up.
## Description
# Lenovo Carbon X1 Gen 7 - Audio and microphone fix - kernel 5.3+ required.
# The script has only been tested for Arch and OpenSuse,
# Original thread: https://forums.lenovo.com/t5/Ubuntu/Guide-X1-Carbon-7th-Generation-Ubuntu-compatability/td-p/4489823
# Prereq: Install Linux 5.3 or newer
@hamidzr
hamidzr / chefBobbyPrices.sh
Created August 14, 2019 22:55
fetch daily signature prices from https://mychefbobby.myshopify.com/ into csv
#!/bin/bash
# fetch daily signature prices from https://mychefbobby.myshopify.com/ into csv
type pup > /dev/null
if [ $? != 0 ]; then
echo "pup" is required for this script to work
exit 1
fi