Skip to content

Instantly share code, notes, and snippets.

View anonhostpi's full-sized avatar
📝
Studying...

Blue Falcon anonhostpi

📝
Studying...
View GitHub Profile
@anonhostpi
anonhostpi / $AUTOGPT.md
Last active May 13, 2023 01:18
AutoGPT Conversation Trackers

Description:

Tracks AutoGPT Conversations and Categorizes them for easy access

  • mainly used by anonhostpi to track common issues with AutoGPT

A lot of issues/prs/discussions end up getting recreated, because contributors struggle to find previous issues

Since I am a junkie for issue tracking, I have created this public gist to help others navigate AutoGPT's repo.

- my discord name: anonhostpi 
@anonhostpi
anonhostpi / rustdesk-docker.sh
Created August 2, 2023 08:15
RustDesk Server & Docker Quick Setup in 5 lines of bash
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo docker image pull rustdesk/rustdesk-server
sudo docker run --name hbbs -p 21115:21115 -p 21116:21116 -p 21116:21116/udp -p 21118:21118 -v `pwd`:/root -td --net=host rustdesk/rustdesk-server hbbs -r echo "${HOSTNAME,,}.local:21117"
sudo docker run --name hbbr -p 21117:21117 -p 21119:21119 -v `pwd`:/root -td --net=host rustdesk/rustdesk-server hbbr
@anonhostpi
anonhostpi / rustdesk-docker-portainer.sh
Created August 2, 2023 08:22
RustDesk Server, Docker, and Portainer Quick Setup in 7 lines of bash
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo docker image pull rustdesk/rustdesk-server
sudo docker run --name hbbs -p 21115:21115 -p 21116:21116 -p 21116:21116/udp -p 21118:21118 -v `pwd`:/root -td --net=host rustdesk/rustdesk-server hbbs -r echo "${HOSTNAME,,}.local:21117"
sudo docker run --name hbbr -p 21117:21117 -p 21119:21119 -v `pwd`:/root -td --net=host rustdesk/rustdesk-server hbbr
docker volume create portainer_data
docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
@anonhostpi
anonhostpi / packaging.ps1
Last active October 7, 2023 11:29
NuGet.Frameworks and Microsft.NETCore.Platforms wrappers for PowerShell (bootstrap code for writing an Import-Package cmdlet)
& {
Add-Type -AssemblyName System.Runtime # Useful for RID detection
Add-Type -AssemblyName System.IO.Compression.FileSystem # Useful for reading nupkg/zip files
# Exported methods and properties
$Exported = New-Object psobject
$Exported | Add-Member `
-MemberType ScriptMethod `
-Name GetLatest `
@anonhostpi
anonhostpi / .avalonia.md
Last active October 16, 2023 08:03
How Avalonia Handles Multithreading

Preface:

This document serves at an attempt to reverse engineer, study, and simplify the usage and creation of Avalonia.Threading.Dispatcher. The goal of the document is to try to rewrite Avalonia.Threading.Dispatcher in such a way that it is not hardlinked to a UI Thread. This will expand its usability in other applications (like PowerShell threads) and allow the end user to associate a dispatcher with any thread they want.

My plan is to have the code used in avalonia eventually reimplemented as an extension to the System.Threading.Thread class. For now, I am mostly interested in reimplementing their dispatcher in PowerShell Core as an alternative to System.Windows.Threading.Dispatcher. That class is WPF-only and currently there is no fully cross-platform reimplementation of that class.

Avalonia is pretty close, but, again, it is hard associated with a UI and its thread; all I need to do is break that hard association.

@anonhostpi
anonhostpi / avalonia.threading.ps1
Created October 21, 2023 06:23
Avalonia.Threading.Dispatcher Testing
<#
$Dispatcher = {
$App = @{}
& {
$builder = [Avalonia.AppBuilder]::Configure[Avalonia.Application]()
$builder = [Avalonia.AppBuilderDesktopExtensions]::UsePlatformDetect( $builder )
$App.Lifetime = [Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime]::new()
$App.Lifetime.ShutdownMode = [Avalonia.Controls.ShutdownMode]::OnExplicitShutdown
@anonhostpi
anonhostpi / wslnetmapper.ps1
Last active January 7, 2024 16:45
WSL Network Adapter Mapper
# https://gist.github.com/anonhostpi/fe3c88c8371b0a495ff39942d8aeadac
function global:Get-WSLNetMapping {
# Notify user if Mirroring Mode is not enabled
param(
[Alias("d")]
$Distribution
)
@anonhostpi
anonhostpi / Edit-Profile.ps1
Last active January 8, 2024 08:38
Simple edit profile in code
https://gist.github.com/anonhostpi/c9117bc3e344898690624dbb804faa19
function Edit-Profile {
param(
[Parameter(Position=0)]
[ValidateSet("CurrentUserCurrentHost", "CurrentUserAllHosts", "AllUsersCurrentHost", "AllUsersAllHosts")]
[string]$Type = "CurrentUserCurrentHost"
)
code ($Profile.$Type | Split-Path -Parent) $Profile.$Type
@anonhostpi
anonhostpi / java.ps1
Created January 14, 2024 05:46
Run Java in PowerShell
using namespace Python.Runtime
# Install-Module Import-Package | Import-Module
Import-Package pythonnet
& {
$dll = Try {
where.exe python | ForEach-Object {
$root = $_ | Split-Path -Parent
$name = $root | Split-Path -Leaf
@anonhostpi
anonhostpi / r.ps1
Created January 14, 2024 12:46
Run R code in PowerShell
Import-Package R.NET
$r = [RDotNet.REngine]::GetInstance()
$r.Evaluate('cat("Hello World")')