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 requests | |
import json | |
def ollama_generate(host="localhost", model="phi3", prompt="Why is the sky blue?", verbose=False): | |
url = f"http://{host}:11434/api/generate" | |
data = {"model": model, "prompt": prompt} | |
headers = {'Content-Type': 'application/json'} | |
response = requests.post(url, json=data, headers=headers, stream=True) | |
if response.status_code == 200: | |
final_response = "" |
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 | |
# Default config seems to work properly w/ libcamera apps | |
# But autofocus doesn't work until this is run. | |
wget -O install_pivariety_pkgs.sh https://github.com/ArduCAM/Arducam-Pivariety-V4L2-Driver/releases/download/install_script/install_pivariety_pkgs.sh | |
chmod +x install_pivariety_pkgs.sh | |
sudo ./install_pivariety_pkgs.sh -p libcamera_dev | |
sudo ./install_pivariety_pkgs.sh -p libcamera_apps |
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
param ( | |
[Parameter(Mandatory=$true)] | |
[string]$ShowName | |
) | |
$files = Get-ChildItem -File -Filter "*.mkv" | |
foreach ($file in $files) { | |
$seasonEpisode = [regex]::Match($file.Name, 'S\d{2}E\d{2}').Value | |
$extension = $file.Extension |
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
# Run without arguments to see what is found. | |
# Run with a path as an argument to create links to ollama models there. | |
# This will remove any files that follow the exact filename as the new link file, so use with caution! | |
import os | |
import sys | |
import json | |
import platform |
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 | |
# This is like "code" or "codium" but on a remote device. Often when I'm writing something on a Raspberry Pi | |
# it can be useful to open the current folder in VSC or VSCodium on a different machine | |
PROJPATH="$(pwd)" | |
# for VSCode on macOS change to RCOMMAND="/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code" | |
RCOMMAND="codium" |
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 | |
function error_exit { | |
echo "" | |
echo "There was an error installing the game or the obb file. Look above for more info." | |
echo "" | |
echo "Things to try:" | |
echo "Check that the device (and only the device) is listed with "adb devices" from a command prompt." | |
echo "Make sure all Developer options look normal on the device" | |
echo "Check that the device has an SD card." |
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
# If you run this as a script it should patch and compile BPG for you | |
wget http://bellard.org/bpg/libbpg-0.9.tar.gz | |
tar xvzf libbpg-0.9.tar.gz | |
cd libbpg-0.9 | |
wget https://gist.githubusercontent.com/bsharper/dd517547f6e1bcabf6be/raw/d125ab609e07e4fd624137543d36eb48bcaab91b/bpg_osx.patch | |
patch -p1 < bpg_osx.patch | |
# Output should be: | |
# patching file Makefile | |
# patching file libavutil/mem.c | |
# If you see something like "patch unexpectedly ends in middle of line" it should still work |