Skip to content

Instantly share code, notes, and snippets.

View dranger003's full-sized avatar

DAN™ dranger003

  • Canada
  • 22:33 (UTC -04:00)
View GitHub Profile
@dranger003
dranger003 / Enable_vt100_csharp.cs
Created January 27, 2018 21:13 — forked from tomzorz/Enable_vt100_csharp.cs
Enable VT100 for the current console window from .NET Core
using System;
using System.Runtime.InteropServices;
namespace Vt100Test
{
public class Program
{
// ReSharper disable InconsistentNaming
#!/bin/bash
set -e
# Update sudoers file
if [ -f /etc/sudoers ]; then
sudo perl -i -pe 's/(^%sudo.*)(ALL=\(ALL:ALL\) ALL)/$1ALL=\(ALL:ALL\) NOPASSWD:ALL/' /etc/sudoers
else
echo "/etc/sudoers not found, check your system configuration"
exit 1
fi
#!/bin/bash
set -e
# Check if miniconda3 is installed
if [ ! -d "miniconda3" ]; then
echo "miniconda3 directory not found, please run the init.sh script first"
exit 1
fi
# Source Conda shell script
@dranger003
dranger003 / server.py
Last active February 14, 2025 14:13
Phi-3-Vision-128K-Instruct Quick Local API
# server.py
# uvicorn server:app --reload
import base64
import queue
import threading
import torch
from PIL import Image
from io import BytesIO
@dranger003
dranger003 / run_model_stream.py
Created May 25, 2024 22:51
Phi-3-Vision-128K-Instruct Stream
# run_model_stream.py
import sys
import re
import os
import queue
import threading
import torch
from PIL import Image
@dranger003
dranger003 / ConvertToImagesAsync.cs
Created June 3, 2024 02:00
Convert PDF to images using C# and the Windows Runtime (no third party dependencies).
// csproj:
// <TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
// <ItemGroup><PackageReference Include="System.Drawing.Common" Version="8.0.6" /></ItemGroup>
using System.Drawing;
using System.Drawing.Imaging;
using Windows.Data.Pdf;
using Windows.Storage;
using Windows.Storage.Streams;
@dranger003
dranger003 / vllm-tool-parser-plugin-command-r7b.py
Last active January 10, 2025 22:26
A vLLM tool parser plugin for Command-R7B that handles function calling through action blocks.
# ** HOW TO USE **
# python -m vllm.entrypoints.openai.api_server \
# --pipeline-parallel-size "$GPU_COUNT" \
# --api-key "$API_KEY" \
# --model CohereForAI/c4ai-command-r7b-12-2024 \
# --chat-template c4ai-command-r7b-12-2024-tool_use.jinja \
# --chat-template-content-format string \
# --enable-auto-tool-choice \
# --tool-parser-plugin vllm-tool-parser-plugin-command-r7b.py \
# --tool-call-parser command-r7b