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:
@frankyxhl
frankyxhl / zoho_send_email.py
Last active May 14, 2024 21:42
Python script to send email by zoho.com's mail service
# Code from best solution in page below:
# https://help.zoho.com/portal/community/topic/zoho-mail-servers-reject-python-smtp-module-communications
import smtplib
from email.mime.text import MIMEText
from email.header import Header
from email.utils import formataddr
# Define to/from
sender = 'sender@example.com'
@henvic
henvic / Migration.md
Last active May 14, 2024 21:40
Migrating to a new Mac

Here are the steps I took for migrating from a early-2013 MacBook Pro Retina 15-inch to a late-2013 one.

  1. Disconnected from the Internet (at least it will simplify
  2. Updated my TimeMachine (TM) backup ("Back Up Now" on the status bar)
  3. Disconnected my TM hard drive and connected it to the new Mac
  4. Turned off the TM backup and Backblaze from the old machine
  5. Connected the TM backup disk to the new Mac
  6. Selected the TM restore process on the install process, but it never showed up, so I restarted it with the 'option' key down and selected the TM code, entered its password and continued with the installer from there
  7. Waited about 3 hours till the data transfer (about 200GB from a stock external drive) was done
  8. Logged in my account
@gpshead
gpshead / Dockerfile
Last active May 14, 2024 21:38
Build a Linux 4 Tegra with CUDA Ubuntu 22.04 docker image for the nVidia Jetson Nano using its final JetPak 4.6.3
# Make an Ubuntu 22.04 Docker image supporting CUDA and Linux 4 Tegra stuff on
# the nVidia Jetson Nano. I ran this from the final nano Linux 4 Tegra JetPak
# image aka jetson-nano-jp461-sd-card-image.zip which I updated to 4.6.3
# using apt. -- @gpshead
#
# Is there any real point to doing this? I have no idea. :P
# If you don't care about toying with the GPU stuff, just go install Armbian.
#
# This is based off of the instructions on
# https://github.com/NVIDIA/nvidia-docker/wiki/NVIDIA-Container-Runtime-on-Jetson
@mwaskom
mwaskom / SDT_Tutorial.ipynb
Last active May 14, 2024 21:37
Translation of Justin Gardner's Signal Detection Theory tutorial from MATLAB into Python
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@HomemadeToast57
HomemadeToast57 / AnimalWell.py
Created June 10, 2022 00:33
Animal Well Puzzle
# Python code written by @HomemadeToast57 (twitter) for the Animal Well puzzle :). Thank you to the devs and the community for this wonderful experience!
import numpy as np
# string given at https://animalwell.net/fountain
string = "amtmc xumuacm fcze mtnd ysi wehlnd vtgowqkw oqsaa diqgewa hhrpsi cq pf pftqd uh gijdugr"
# key found in trailer for the game
key = "waterfall"
@saratrajput
saratrajput / mujoco_py_install_instructions.md
Created January 27, 2022 08:26
Mujoco and Mujoco-py Installation Instructions

Mujoco and Mujoco-py Installation Instructions

The steps are taken from this video and document with some small changes.

Steps

  1. Install Anaconda. Download it from this link.
cd Downloads/
sudo chmod +x Anaconda3-2021.11-Linux-x86_64.sh
./Anaconda3-2021.11-Linux-x86_64.sh
@Artefact2
Artefact2 / README.md
Last active May 14, 2024 21:35
GGUF quantizations overview

Which GGUF is right for me? (Opinionated)

Good question! I am collecting human data on how quantization affects outputs. See here for more information: ggerganov/llama.cpp#5962

In the meantime, use the largest that fully fits in your GPU. If you can comfortably fit Q4_K_S, try using a model with more parameters.

llama.cpp feature matrix

See the wiki upstream: https://github.com/ggerganov/llama.cpp/wiki/Feature-matrix

@cmer81
cmer81 / cloudflareddns6.sh
Last active May 14, 2024 21:35
dynamic dns IPV6 script for Synology
#!/bin/sh
# cloudflareddns6.sh - dynamic dns IPV6 updater module for Synology
#
# Author:
# Cedric Mercier
#
# Version:
# 0.1
#
@jerrysu
jerrysu / cloudflare.php
Last active May 14, 2024 21:33
Cloudflare DDNS Provider for Synology DiskStation
#!/usr/bin/php -d open_basedir=/usr/syno/bin/ddns
<?php
/**
* This script is used to add Cloudflare as a service provider to DDNS settings on a Synology DiskStation.
*
* This file goes in `/usr/syno/bin/ddns/cloudflare.php`. Edit `/etc.defaults/ddns_provider.conf` and add
* the Cloudflare for it to appear in the "Service provider" list:
*
* [Cloudflare]