Skip to content

Instantly share code, notes, and snippets.

View tinovyatkin's full-sized avatar
💭
I may be slow to respond.

Konstantin Vyatkin tinovyatkin

💭
I may be slow to respond.
View GitHub Profile
@padeoe
padeoe / README_hfd.md
Last active April 28, 2025 02:45
CLI-Tool for download Huggingface models and datasets with aria2/wget: hfd

🤗Huggingface Model Downloader

Note

(2025-01-08) Add feature for 🏷️Tag(Revision) Selection, contributed by @Bamboo-D.
(2024-12-17) Add feature for ⚡Quick Startup and ⏭️Fast Resume, enabling skipping of downloaded files, while removing the git clone dependency to accelerate file list retrieval.

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 leverages curl and aria2c for fast and robust downloading of models and datasets.

Features

  • ⏯️ Resume from breakpoint: You can re-run it or Ctrl+C anytime.
@gaearon
gaearon / 00-README-NEXT-SPA.md
Last active April 25, 2025 13:14
Next.js SPA example with dynamic client-only routing and static hosting

Next.js client-only SPA example

Made this example to show how to use Next.js router for a 100% SPA (no JS server) app.

You use Next.js router like normally, but don't define getStaticProps and such. Instead you do client-only fetching with swr, react-query, or similar methods.

You can generate HTML fallback for the page if there's something meaningful to show before you "know" the params. (Remember, HTML is static, so it can't respond to dynamic query. But it can be different per route.)

Don't like Next? Here's how to do the same in Gatsby.

@statik
statik / waf.ts
Last active October 16, 2024 02:36
WAF with CDK examples
import * as cdk from "@aws-cdk/core";
import * as wafv2 from "@aws-cdk/aws-wafv2";
// This extends the base cdk stack properties to include a tag name input.
export interface StackProps extends cdk.StackProps {
tag: string;
applicationName?: string;
}
export class WAFStack extends cdk.Stack {
@louischan
louischan / lambda-php-runtime.md
Created December 20, 2020 14:48
AWS Lambda PHP 8 Custom Runtime (Amazon Linux 2)
  1. Compile PHP in a Amazon Linux 2 machine
sudo yum update -y
mkdir php
curl -sL https://github.com/php/php-src/archive/php-8.0.0.tar.gz | tar -xvz
cd php-src-php-8.0.0/
sudo yum install -y gcc autoconf bison re2c libcurl-devel libxml2-devel openssl-devel sqlite-devel oniguruma-devel libzip-devel bzip2-devel
./buildconf --force
# Run ./configure --help for full list of options
./configure --prefix=/home/ec2-user/php/ --with-openssl --with-curl --with-zlib --with-zip --enable-mbstring --enable-cli
@eladb
eladb / cdk8s-eks.ts
Created March 10, 2020 13:28
cdk8s + EKS = ❤️
import * as eks from '@aws-cdk/aws-eks';
import * as iam from '@aws-cdk/aws-iam';
import * as cdk8s from 'cdk8s';
import { Construct, Stack, StackProps } from '@aws-cdk/core';
import * as k8s from '../imports/k8s';
export class TestClusterStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
@qzm
qzm / aria2.conf
Last active April 18, 2025 06:09
Best aria2 Config
### Basic ###
# The directory to store the downloaded file.
dir=${HOME}/Downloads
# Downloads the URIs listed in FILE.
input-file=${HOME}/.aria2/aria2.session
# Save error/unfinished downloads to FILE on exit.
save-session=${HOME}/.aria2/aria2.session
# Save error/unfinished downloads to a file specified by --save-session option every SEC seconds. If 0 is given, file will be saved only when aria2 exits. Default: 0
save-session-interval=60
# Set the maximum number of parallel downloads for every queue item. See also the --split option. Default: 5
@YoRyan
YoRyan / pipe-to-eventsource.py
Last active March 17, 2025 13:39
Serve up a text stream with dynamic updates using Python and EventSource. This took me more time to create than I'm willing to admit and I'm proud.
#!/usr/bin/env python3
import threading
from copy import copy
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from sys import stdin
class ProducerConsumer():
@JozefFlakus
JozefFlakus / marblejs-example.ts
Created May 12, 2019 15:45
Marble.js - one file example
import { createServer, combineRoutes, httpListener, r } from '@marblejs/core';
import { logger$ } from '@marblejs/middleware-logger';
import { bodyParser$ } from '@marblejs/middleware-body';
import { map, mapTo } from 'rxjs/operators';
// USERS API definition
const getUserList$ = r.pipe(
r.matchPath('/'),
r.matchType('GET'),
@Bnaya
Bnaya / fetch-stream-json-parser.ts
Created April 9, 2019 08:24
fetch-stream-json-parser.ts basic code example
// https://github.com/dominictarr/JSONStream
// @ts-ignore
import JSONStream from "JSONStream";
import { Observable } from "rxjs";
class Bla {
public creativesOfChannelV4StreamEndpoint<T=any>(
channel: T,
brandId: string,
[celery]
# The Celery broker URL. Celery supports RabbitMQ, Redis and experimentally
# a sqlalchemy database. Refer to the Celery documentation for more
# information.
broker_url = sqs://{ACCESS_KEY_ID}:{SECRET_KEY}@
# Note: You will also need to install boto:
$ pip install -U boto