Skip to content

Instantly share code, notes, and snippets.

View dranger003's full-sized avatar

DAN™ dranger003

  • Canada
  • 13:57 (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 June 2, 2024 01:24
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;