Skip to content

Instantly share code, notes, and snippets.

@mkrupczak3
mkrupczak3 / nv-power-limit-fixed.sh
Created February 26, 2024 21:55
Fixed script from Puget Systems article
#!/usr/bin/env bash
# Set power limits on all NVIDIA GPUs
# Make sure nvidia-smi exists
command -v nvidia-smi &> /dev/null || { echo >&2 "nvidia-smi not found ... exiting."; exit 1; }
# adjust as needed
POWER_LIMIT=270
# modified, this line relies on the assumption that all GPUs are the same model
[Unit]
Description=NVIDIA GPU Set Power Limit
After=syslog.target systemd-modules-load.service
ConditionPathExists=/usr/bin/nvidia-smi
[Service]
User=root
Environment="PATH=/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
ExecStart=/usr/local/sbin/nv-power-limit.sh
#!/usr/bin/env bash
# Set power limits on all NVIDIA GPUs
# Make sure nvidia-smi exists
command -v nvidia-smi &> /dev/null || { echo >&2 "nvidia-smi not found ... exiting."; exit 1; }
POWER_LIMIT=280
MAX_POWER_LIMIT=$(nvidia-smi -q -d POWER | grep 'Max Power Limit' | tr -s ' ' | cut -d ' ' -f 6)
@mkrupczak3
mkrupczak3 / requirements.txt
Created July 25, 2023 15:53 — forked from claysauruswrecks/requirements.txt
Example using LlamaHub loaders to index Github repos into LlamaIndex and query GPTSimpleVectorIndex with GPT-4
# main
llama-index
langchain
@mkrupczak3
mkrupczak3 / CursorOnTargetSender.java
Created June 29, 2023 17:16
Reference implementation for sending CursorOnTarget in Android app. This reference implementation is under the MIT licesne and may be used for commercial purposes
package com.openathena;
import org.w3c.dom.CDATASection;
import org.w3c.dom.Comment;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xmlpull.v1.XmlSerializer;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@mkrupczak3
mkrupczak3 / Theta_Contributor_Agreement.txt
Last active June 19, 2023 21:20
Theta external Contributor License Agreement
Contributor License Agreement
The following terms are used throughout this agreement:
You - the person or legal entity including its affiliates asked to accept this agreement. An affiliate is any entity that controls or is controlled by the legal entity, or is under common control with it.
Project - is an umbrella term that refers to any and all Theta open source projects.
Contribution - any type of work that is submitted to a Project, including any modifications or additions to existing work.
Submitted - conveyed to a Project via a pull request, commit, issue, or any form of electronic, written, or verbal communication with Theta, contributors or maintainers.
1. Grant of Copyright License.
@mkrupczak3
mkrupczak3 / memo-ized_recursive_exponent_calculator.java
Last active October 5, 2022 18:55
A recursive exponent cacluation calculator for integers, sped up by memo-ization
import java.util.Scanner;
import java.util.ArrayList;
import java.util.InputMismatchException;
import java.util.Dictionary;
import java.util.Hashtable;
class Main {
public static void main(String args[]){
Scanner beepBoop = new Scanner(System.in);
@mkrupczak3
mkrupczak3 / supervisely_json_to_yolo_txt.py
Last active September 28, 2022 00:56
Custom script to convert from Supervisely label to YOLO label format for Machine Learning training
#!/usr/bin/env python3
"""
supervisely_json_to_yolo_txt.py
This script is intended to convert the Javascript Object notation based Supervisely labels from the FSOCO dataset to a txt-based yolo format we can use for training
The Supervisely label format specifies the top-left and bottom-right corners of the object in number of pixels from the origin (at the top left of the image)
The yolo label format specifies the object class as an integer, followed by <x_center> <y_center> <width> <height> where each are a propotion (float values from 0 to 1, exclusive) of the total image width or height, measured from the origin at the top left corner
@mkrupczak3
mkrupczak3 / gist:f283e1cc48cf5cc876cb7fe36f57fc94
Created August 11, 2022 15:54 — forked from ppearson/gist:52774
Python NMEA to GPX converter script
# NMEA to GPX converter
# Peter Pearson
# version 0.11
import csv
import sys
import time
from time import strftime
def convert_dms_to_dec(value, dir):
@mkrupczak3
mkrupczak3 / protrails_to_gpx.py
Created August 11, 2022 15:46 — forked from kingds/protrails_to_gpx.py
Python script for converting sets of GPS coordinates from protrails.com into a GPX file which can be loaded onto a GPS device.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This is a script for converting coordinates from a protrails.com trail description into a
# gpx file that can be loaded onto a GPS device.
# In order to use it, copy and paste the coordinates from the protrails map page (not the
# main page for the hike, but the page with the link "Interactive GPS Topo Map") into an input
# file. Run the script with # python protrails_to_gpx.py <input file> <output file> <route name>
from lxml import etree as tree