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 bash | |
# Usage: groq.sh "Convert foo to bar" < file.foo > file.bar | |
set -Eeuo pipefail | |
content="$@ | |
$(cat)" | |
escaped_content=$(jq -Rsa . <<< "$content") | |
model="llama-3.1-8b-instant" |
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
/** | |
* nformat - significant digits and maximum precision aware number formatting with SI prefixes + null value handling | |
* | |
* Examples: | |
* nformat({na: "", maxPrecision: 5, significantDigits: 4, si: "si", unit: 'J', value: 1231.2278346237846e12}) | |
* -> "1.2313 PJ" | |
* nformat({na: "", maxPrecision: 1, significantDigits: 9, si: "english", unit: ' kg', value: 1231.2278346237846e4}) | |
* -> "12.3122783M kg" | |
* nformat({na: "", maxPrecision: 2, significantDigits: 3, unit: ' s', value: 1231.2278346237846e-3}) | |
* -> "0.12 s" |
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
// https://help.braiins.com/en/support/solutions/articles/77000433512-api-configuration-guide | |
type HashRateUnit = "Gh/s" | "Th/s" | "Ph/s"; | |
const _sampleStatsResponse: GeneralPoolStatsResponse = { | |
btc: { | |
luck_b10: "0.77", | |
luck_b50: "0.85", | |
luck_b250: "0.93", | |
hash_rate_unit: "Gh/s", |
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
sudo mount -t drvfs 'G:\\' -o 'uid=1000;gid=1000;metadata;symlinkroot=/mnt/,mmap,access=client,msize=262144,trans=virtio,rw,noatime,dirsync,aname=drvfs' /mnt/g |
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 sys | |
from xml.sax.saxutils import escape | |
import winrt.windows.ui.notifications as notifications | |
import winrt.windows.data.xml.dom as dom | |
from winrt.windows.ui.notifications import ToastNotificationManager, ToastNotification, ToastTemplateType | |
if not sys.argv[2:]: | |
print(f'Usage: {sys.argv[0]} <title> <message ...>') | |
sys.exit(1) |
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
from typing import List, Optional, Union | |
from dataclasses import dataclass | |
@dataclass | |
class CallbackGame: pass # Placeholder - zero fields in API doc | |
InputMessageContent = Union[ | |
'InputTextMessageContent', | |
'InputLocationMessageContent', |
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 http.server | |
import socketserver | |
import os, sys, re, glob, shutil | |
from pathlib import * | |
PORT = int(sys.argv[1]) | |
def get_known(): | |
try: | |
known_bad = list({x.strip() for x in open('known_bad.txt').read().strip().split('\n')}) |
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, glob, sys | |
import time | |
from selenium import webdriver | |
from selenium.webdriver.common.by import By | |
from selenium.webdriver.common.keys import Keys | |
from selenium.webdriver.support.ui import WebDriverWait | |
from selenium.webdriver.support.expected_conditions import presence_of_element_located | |
from selenium.webdriver.support import expected_conditions as EC | |
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 bash | |
# Fix simple .SM and .SSC chart mistakes when the first entry of #BGCHANGES | |
# points to a file that doesn't exist and when there's another file of the | |
# same extension in the song directory. | |
# | |
# E.g. Ben Speirs' SPEIRMIX GALAXY has a lot of these mismatching filenames. | |
find -type f \ | |
\( -iname '*.sm' -or -iname '*.ssc' \) \ | |
-exec grep -l '#BGCHANGES:[^;]' {} + | |
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 bash | |
# | |
# This is an install script to get a working Swift for Tensorflow | |
# environment with minimal fuss. Assumes Ubuntu 18.04 and bash. | |
# | |
# The script is idempotent so it can be safely run multiple times. | |
# | |
# The script uses an existing Anaconda/Miniconda installation | |
# or installs Miniconda to ~/miniconda3 if missing | |
# |
NewerOlder