Skip to content

Instantly share code, notes, and snippets.

@ctlllll
ctlllll / longest_chinese_tokens_gpt4o.py
Created May 13, 2024 19:53
Longest Chinese tokens in gpt4o
import tiktoken
import langdetect
T = tiktoken.get_encoding("o200k_base")
length_dict = {}
for i in range(T.n_vocab):
try:
length_dict[i] = len(T.decode([i]))
except:
@mallendeo
mallendeo / 100.conf
Last active October 14, 2024 20:59
Windows 11 Gaming VM on Proxmox VFIO
##/etc/pve/qemu-server/100.conf
##Network and disks not included in this example
##Set halt_poll_ns
#set_halt_poll 0
##CPU pinning
#cpu_taskset 1-7
#assign_interrupts --sleep=10s 1-7 --all
agent: 1
@tomdaley92
tomdaley92 / README.md
Last active November 8, 2024 11:22
Proxmox - SPICE Client setup for MacOS

Proxmox - SPICE client setup for MacOS

  1. Install a working (and compiled) version of virt-viewer. You may view the homebrew package's upstream source on GitHub.

    brew tap jeffreywildman/homebrew-virt-manager
    brew install virt-viewer
  2. Once that's installed should be able make a call remote-viewer with a pve-spice.vv file downloaded from proxmox web interface

@FreddieOliveira
FreddieOliveira / docker.md
Last active November 16, 2024 08:51
This tutorial shows how to run docker natively on Android, without VMs and chroot.

Docker on Android 🐋📱

Edit 🎉

All packages, except for Tini have been added to termux-root. To install them, simply pkg install root-repo && pkg install docker. This will install the whole docker suite, left only Tini to be compiled manually.


Summary

@citruz
citruz / QEMU_ON_M1.md
Last active October 24, 2024 02:17
Create Ubuntu and Windows VMs with QEMU on Apple Silicon

Running Linux and Windows on M1 with QEMU

30.11.2020: Updated with the new patchseries and instructions for Windows

02.12.2020: Added tweaks

08.12.2020: Updated with patchseries v4

31.01.2020: Updated with patchseries v6

@Webreaper
Webreaper / docker-compose.yml
Last active October 29, 2024 12:32
Sample Docker-compose file which shows how to set up Sonarr, Radarr, Prowlarr, Lidarr, QBittorrent and a VPN container so that all all traffic from the containers is routed through the VPN. Also includes Plex and get_iplayer containers, which are not routed through the VPN.
# Docker compose to set up containers for all services you need:
# VPN
# Sonarr, Radarr, Lidarr, Qbittorrent
# Non-VPN
# Plex, get_iplayer
# Before running docker-compose, you should pre-create all of the following folders.
# Folders for Docker State:
# /volume1/dockerdata. - root where this docker-compose.yml should live
# /volume1/dockerdata/plex - Plex config and DB
# /volume1/dockerdata/sonarr - Sonarr config and DB

If .DS_Store was never added to your git repository, simply add it to your .gitignore file.

If you don't have one, create a file called

.gitignore

In your the root directory of your app and simply write

Install vbox from source (tested on Ubuntu Server 16.04.1 LTS):
===============================================================
# Build dependencies can be found at:
# https://www.virtualbox.org/wiki/Linux%20build%20instructions
#
# unfortunatly, they are always outdated (thx Oracle)
# here are the missing pkg on Ubuntu Server 16.04.1 LTS:
apt-get install subversion build-essential bcc iasl xsltproc uuid-dev \
@Geekfish
Geekfish / merge_pdfs.py
Created January 31, 2017 16:07
pyPDF2 merge 2 pdf pages into one
from PyPDF2 import PdfFileReader, PdfFileWriter
from PyPDF2.pdf import PageObject
reader = PdfFileReader(open("invoice.pdf",'rb'))
invoice_page = reader.getPage(0)
sup_reader = PdfFileReader(open("supplement.pdf",'rb'))
sup_page = sup_reader.getPage(1) # We pick the second page here
translated_page = PageObject.createBlankPage(None, sup_page.mediaBox.getWidth(), sup_page.mediaBox.getHeight())
@marsam
marsam / pdfembed.py
Created November 5, 2013 22:09
pdf embed
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
pdfembed
=========
Embed a pdf inside another.
Dependencies:
- pdfrw_