Skip to content

Instantly share code, notes, and snippets.

@padeoe
padeoe / README_hfd.md
Last active May 14, 2024 09:16
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.
@pavel-kirienko
pavel-kirienko / 51-xbox-gamepad.rules
Last active May 14, 2024 09:15 — forked from dnmodder/fixcontroller.py
Use Microsoft X-Box 360 Gamepad with GNU/Linux
# By default, X-Box 360-compatible controllers are detectable but dysfunctional because they expect the host
# to send a particular USB control transfer with some sort of initialization command.
# This udev rule will invoke a trivial Python script automatically when the gamepad is connected that emits
# the required initialization command.
#
# Integration:
# 1. Put this rule into /etc/udev/rules.d/51-xbox-gamepad.rules
# 2. Install pyusb for the root's Python: sudo pip install pyusb
# 3. Reload udev rules as root: udevadm control --reload-rules && udevadm trigger
#
@chriskoelle
chriskoelle / max-image-size.js
Created December 16, 2014 20:06
Use javascript and canvas to resize images from file input before upload
jQuery(function($) {
// Test for file API support.
var fileApiSuport = !!(window.File && window.FileReader );
/**
* Resize images that exceed the maximum size (in pixels)
* @param {object} input The file input.
* @param {Function} callback Callback function run after the image has been resized.
* @return {null}
*/
@mda590
mda590 / boto3_listinstances_example.py
Last active May 14, 2024 09:14
Example using boto3 to list running EC2 instances
import boto3
ec2 = boto3.resource('ec2')
def lambda_handler(event, context):
# create filter for instances in running state
filters = [
{
'Name': 'instance-state-name',
'Values': ['running']
@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:
@umayr
umayr / recover-deleted-branch.sh
Created April 1, 2016 11:41
How to recover a deleted branch
## Pre-requisite: You have to know your last commit message from your deleted branch.
git reflog
# Search for message in the list
# a901eda HEAD@{18}: commit: <last commit message>
# Now you have two options, either checkout revision or HEAD
git checkout a901eda
# Or
git checkout HEAD@{18}
@sebzur
sebzur / polish_holidays.py
Created February 12, 2012 20:25
Python generator for public holidays in Poland
from datetime import date, timedelta
from dateutil import easter
from dateutil.relativedelta import *
def get_holidays(year=2010):
""" Returns Polish hollidays dates (legally considered non-working days) """
easter_sunday = easter.easter(year)
holidays = {'New Year': date(year,1,1),
'Trzech Kroli': date(year,1,6),
'Easter Sunday': easter_sunday,
@skoqaq
skoqaq / build4123.sublime4.key
Last active May 14, 2024 09:01
Sublime Text 4 License Key
—– BEGIN LICENSE —–
Mifeng User
Single User License
EA7E-1184812
C0DAA9CD 6BE825B5 FF935692 1750523A
EDF59D3F A3BD6C96 F8D33866 3F1CCCEA
1C25BE4D 25B1C4CC 5110C20E 5246CC42
D232C83B C99CCC42 0E32890C B6CBF018
B1D4C178 2F9DDB16 ABAA74E5 95304BEF
9D0CCFA9 8AF8F8E2 1E0A955E 4771A576
@tkurki
tkurki / 00doc.md
Last active May 14, 2024 08:59
Wind Speed and Direction with Grafana ECCharts plugin
@luckylittle
luckylittle / Splunk_Certified_Cybersecurity_Defense_Analyst.md
Last active May 14, 2024 08:59
Splunk Certified Cybersecurity Defense Analyst [SPLK-5001] - Notes

Splunk Certified Cybersecurity Defense Analyst [SPLK-5001]

1.0 The Cyber Landscape, Frameworks, and Standards (*10%*)
  1.1 Summarize the organization of a typical SOC and the tasks belonging to Analyst, Engineer and Architect roles.
  1.2 Recognize common cyber industry controls, standards and frameworks and how Splunk incorporates those frameworks.
  1.3 Describe key security concepts surrounding information assurance including confidentiality, integrity and availability and basic risk management.

2.0 Threat and Attack Types, Motivations, and Tactics (*20%*)
  2.1 Recognize common types of attacks and attack vectors.