Skip to content

Instantly share code, notes, and snippets.

@evisotskiy
evisotskiy / dynamic-import.js
Last active May 6, 2024 11:01
Right gynamic import
/* for vanilla js */
async function getComponent() {
const element = document.createElement('div');
const { default: _ } = await import(/* webpackChunkName: "lodash" */ 'lodash');
element.innerHTML = _.join(['Hello', 'webpack'], ' ');
return element;
}
@padeoe
padeoe / README_hfd.md
Last active May 6, 2024 11:01
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.
@doichev-kostia
doichev-kostia / gcp-batch-data.ts
Created November 8, 2023 15:59
GCP storage batch multipart data body generator https://cloud.google.com/storage/docs/batch#http
import { describe, it } from 'node:test';
import { randomUUID } from 'node:crypto';
import * as assert from 'node:assert';
export type Serializable = string | Uint8Array;
type ContentId = string;
export type GCPBatchDataItem = {
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
/**
@airy10
airy10 / airtag-decryptor.swift
Last active May 6, 2024 11:00
Decrypt all beacons files from ~/Library/com.apple.icloud.searchpartyd
//
// airtag-decryptor.swift
//
// Decrypt all beacons files from ~/Library/com.apple.icloud.searchpartyd - updated when FindMy is running
// Results in /tmp/com.apple.icloud.searchpartyd - same file hierarchy
//
// Created by Matus on 28/01/2024. - https://gist.github.com/YeapGuy/f473de53c2a4e8978bc63217359ca1e4
// Modified by Airy
//
import Cocoa
@danleavitt0
danleavitt0 / index.js
Last active May 6, 2024 10:59
default
var {loop, move, motor, read, sleep, out} = require('robot-loop')
loop(main /*,ip address*/)
var steer = move()
function main (input) {
if (input === 'forward') {
forward()
} else if (input === 'back') {
back()
@ericoporto
ericoporto / 1.Instructions.md
Created October 19, 2020 02:10 — forked from WesThorburn/1.Instructions.md
Linux: Compile C++ to WebAssembly and JavaScript using Emscripten and CMake

Linux: Compile C++ to WebAssembly and JavaScript using Emscripten and CMake

Download and Install Emscripten

  • My preferred installation location is /home/user
  • Get the latest sdk: git clone https://github.com/emscripten-core/emsdk.git
  • Enter the cloned directory: cd emsdk
  • Install the lastest sdk tools: ./emsdk install latest
  • Activate the latest sdk tools: ./emsdk activate latest
  • Activate path variables: source ./emsdk_env.sh
  • Configure emsdk in your bash profile by running: echo 'source "/home/user/emsdk/emsdk_env.sh"' >> $HOME/.bash_profile
@mxriverlynn
mxriverlynn / defaults.js
Created August 22, 2012 02:11
defaults
// backbone's `defaults` can be a function.
//
// if you need the default value to be evaluated
// every time you instantiate a new model, then
// it should be a function, not an object literal.
//
// object literals are only evaluated once, when the
// object is defined.
{
"scripts": [],
"styles": []
}
@xavaz
xavaz / default.html
Last active May 6, 2024 10:58
default
lol --
@SenZmaKi
SenZmaKi / imageCompressorWorker.ts
Last active May 6, 2024 10:58
When dealing with numerous high-resolution large file size images in Chromium, you might encounter janky scrolling or other issues since rendering the images blocks the main thread (UI thread). To address this issue, we use a canvas to compress the images first. To avoid blocking the main thread during compression, we perform the compression in …
import type {
CompressorWorkerDTO,
CompressorWorkerResponseDTO,
CompressorWorkerParams,
} from "./types.ts";
// Define behavior for the web worker
self.onmessage = async (msg: { data: CompressorWorkerDTO }) => {
const { bitmap, params } = msg.data;
const { width, height, format, url, quality } = params;