Skip to content

Instantly share code, notes, and snippets.

// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
@philschmid
philschmid / get_memory_size.py
Created January 16, 2025 13:53
Get needed GPU per precision for a Hugging Face Model Id
from typing import Dict, Union
from huggingface_hub import get_safetensors_metadata
import argparse
import sys
# Example:
# python get_gpu_memory.py Qwen/Qwen2.5-7B-Instruct
# Dictionary mapping dtype strings to their byte sizes
bytes_per_dtype: Dict[str, float] = {
@khalidx
khalidx / event.ts
Created May 10, 2020 13:20
A typed event emitter for TypeScript
// This lets you emit and listen for events in a type-safe manner
// Awesome!
import { EventEmitter } from 'events'
type Type<Name> = { type: Name }
type Value<Type> = { value: Type }
export type TypedValue<T, V> = Type<T> & Value<V>
@lukeplausin
lukeplausin / transfer_ssm_file.sh
Last active January 16, 2025 14:05
Transfer a file to EC2 SSM instance without using S3 (SSM only)
# This script will explain how to transfer a file to EC2 using SSM ONLY!
# You will need to have permission to run SSM commands on the target machine and have sudo access as well
# Infos
INSTANCE_ID=i-1234567890
FILE_NAME=the_file.tar.gz
# Step 1: Run command on machine to install netcat and dump from port to filename
# < Start session
@mjnaderi
mjnaderi / install-arch.md
Last active January 16, 2025 14:03 — forked from mattiaslundberg/arch-linux-install
Installing Arch Linux with Full Disk Encryption (LVM on LUKS)

Installing Arch Linux with Full Disk Encryption

If you're aiming for a seamless Arch Linux installation in UEFI mode, follow along as this guide will walk you through the process step by step. We'll be using LUKS (Linux Unified Key Setup) and LVM (Logical Volume Manager) partitions on LUKS to achieve full disk encryption.

Note: I have updated this doc for UEFI mode. For those with BIOS/MBR systems, you can refer to the previous version, but keep in mind that it might be outdated and no longer accurate.

If you're only interested in installing Linux and not setting up dual boot with Windows, feel free to skip the Windows-related sections.

@K1ethoang
K1ethoang / Active StarUml version 6 for Window | MacOS | Linux.md
Last active January 16, 2025 13:59
Active StarUml version 6 for Window | MacOS | Linux
@aeurielesn
aeurielesn / util.php
Created July 31, 2011 03:47
Decode Unicode strings in PHP
<?php
#source: http://stackoverflow.com/questions/2934563/how-to-decode-unicode-escape-sequences-like-u00ed-to-proper-utf-8-encoded-char
function replace_unicode_escape_sequence($match) {
return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE');
}
function unicode_decode($str) {
return preg_replace_callback('/\\\\u([0-9a-f]{4})/i', 'replace_unicode_escape_sequence', $str);
}
Registered Name: https://zhile.io
License Key: 48891cf209c6d32bf4