Skip to content

Instantly share code, notes, and snippets.

View StrayDragon's full-sized avatar
🎯
Fighting~

L8ng StrayDragon

🎯
Fighting~
View GitHub Profile
@padeoe
padeoe / README_hfd.md
Last active July 22, 2024 07:30
CLI-Tool for download Huggingface models and datasets with aria2/wget+git

🤗Huggingface Model Downloader

Considering the lack of multi-threaded download support in the official huggingface-cli, and the inadequate error handling in hf_transfer, this command-line tool smartly utilizes wget or aria2 for LFS files and git clone for the rest.

Features

  • ⏯️ Resume from breakpoint: You can re-run it or Ctrl+C anytime.
  • 🚀 Multi-threaded Download: Utilize multiple threads to speed up the download process.
  • 🚫 File Exclusion: Use --exclude or --include to skip or specify files, save time for models with duplicate formats (e.g., *.bin or *.safetensors).
  • 🔐 Auth Support: For gated models that require Huggingface login, use --hf_username and --hf_token to authenticate.
  • 🪞 Mirror Site Support: Set up with HF_ENDPOINT environment variable.
@o5
o5 / dump.sh
Last active May 23, 2024 20:09
MySQL / MariaDB Dump Helper
#!/usr/bin/env bash
# MySQL / MariaDB Dump Helper
# ===========================
# FEATURES: Progress bar with ETA, support multiple databases (dump into separated files) and password as argument
# REQUIREMENTS:
# =============
# GNU Core Utilities, mysql, mysqldump, pv (https://github.com/icetee/pv)

Windows 10 - Using Git Bash With TMUX

Why Not Use WSL?

I tried the WSL and it isn't quite seamless enough for me. I ran in to problems when editing in VSCode and having watchers on my files (ng serve, dotnet watch run, etc.). In addition, I kept running in to problems that only manifest themselves when running in WSL. For example, this issue with doing production builds and the terser plugin has made many a developer rage-quit on using WSL. Just figuring out that it was an issue with the WSL took a lot of time.

That terser plugin issue was never resolved and I ended up having to keep a git bash window open in addition to my WSL console window so I could do production builds. To make matters worse, my npm packages were platform-dependent so I couldn't use the same project folder. So, my procedure was: commit whatever changes to test branch, push to repo, git pull on my "windows" project folder, and do a production build there

@chronitis
chronitis / jupyter_kernel_list.md
Last active July 18, 2024 16:16
Updated Jupyter Kernels page

What is a kernel?

The kernel lets you run code in a particular programming language using one of the Jupyter tools, such as the Notebook, Jupyterlab or nteract. Installing additional kernels will let you run code in more languages using your existing jupyter installation.

Technically, the kernel is an application which speaks the Jupyter Messaging Protocol, to receive code input from the frontend and respond with the results.

Which kernels do I have installed?

In the Notebook or JupyterLab, the list of available kernels will be shown when trying to create a new notebook.

@stefanthoss
stefanthoss / export-pyspark-schema-to-json.py
Created June 19, 2019 22:16
Export/import a PySpark schema to/from a JSON file
import json
from pyspark.sql.types import *
# Define the schema
schema = StructType(
[StructField("name", StringType(), True), StructField("age", IntegerType(), True)]
)
# Write the schema
with open("schema.json", "w") as f:
@ZhanruiLiang
ZhanruiLiang / dist.py
Created June 10, 2015 06:56
Distribution of generated numbers by a given total sum
from matplotlib import pyplot as plt
def validate(func, s=100, n=5, trails=100000):
counts = [0] * (s + 1)
for _ in xrange(trails):
for x in func(s, n):
counts[x] += 1
plt.plot(range(s + 1), counts)
plt.show()
@pdanford
pdanford / README.md
Last active February 20, 2023 15:45
OSX <--> Linux VPS Copy and Paste

Description

The below enables OSX style copy and paste between a headless X11 desktop (running on a Linux VPS using fluxbox WM and tightvncserver) and OSX using an OSX VNC client.

It works by remapping X11 keys used by xterm and X11 apps to match OSX command-c and command-v copy and paste. Also enables VNC clients to copy and paste between the OSX and X11 desktops. Note that copy paste works both ways when using the RealVNC OSX client, but with Apple's Screen Sharing you can only paste an X11 copy to the OSX desktop (not vise versa) because it doesn't like autocutsel or Linux or something.

@mitchwongho
mitchwongho / Docker
Last active June 26, 2024 07:28
Docker 'run' command to start an interactive BaSH session
# Assuming an Ubuntu Docker image
$ docker run -it <image> /bin/bash