Skip to content

Instantly share code, notes, and snippets.

View huksley's full-sized avatar
🐈
Step on no pets

Ruslan Gainutdinov huksley

🐈
Step on no pets
View GitHub Profile
@huksley
huksley / train.yml
Last active November 27, 2025 11:25
Skypilot + Verda Cloud training examples
#
# Example job to run on Verda Cloud (formerly DataCrunch).
# This will launch a cluster which will be autodeleted in 120 minutes and will run the training job on it.
#
# $ mkdir -p ${HOME}/.verda
# $ echo { "client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET" } > ${HOME}/.verda/config.json
# $ pip install skypilot[verda]
# $ sky launch -i 120 train.yaml
#
name: minGPT-ddp
@huksley
huksley / deploy-cluster.sh
Last active November 21, 2025 08:37
Deploy B300, 200 or H200 clusters via Verda Cloud (formerly DataCrunch) API
#!/usr/bin/env bash
set -euo pipefail
if [ $# -lt 1 ]; then
echo "usage: $0 ENVIRONMENT" >&2
exit 1
fi
ENVIRONMENT="$1"
@huksley
huksley / inngest.rb
Last active November 9, 2025 14:32
Install inngest via homebrew
class Inngest < Formula
desc "Workflow orchestration platform"
homepage "https://github.com/inngest/inngest/"
url "https://github.com/inngest/inngest.git",
tag: "v1.13.4"
license "Apache-2.0"
head "https://github.com/inngest/inngest.git", branch: "main"
depends_on "go" => :build
@huksley
huksley / btc-price-http.sql
Created September 3, 2025 20:35
BTC price over time
-- Query to fetch Bitcoin price data and format as a nice table
WITH api_response AS (
SELECT content::jsonb as data
FROM http_get('https://api.coingecko.com/api/v3/coins/bitcoin/market_chart?vs_currency=usd&days=300&interval=daily')
),
price_data AS (
SELECT
jsonb_array_elements(data->'prices') as price_array
FROM api_response
)
@huksley
huksley / console.js
Created August 9, 2025 13:35
Get all reactions as portraits from Telegram
function getBase64Image(img) {
var canvas = document.createElement("canvas");
canvas.width = img.naturalWidth;
canvas.height = img.naturalHeight;
var ctx = canvas.getContext("2d");
ctx.drawImage(img, 0, 0);
var dataURL = canvas.toDataURL("image/png");
return dataURL.replace(/^data:image\/(png|jpg);base64,/, "");
}
@huksley
huksley / app.js
Last active July 24, 2025 09:57
Example of NodeJS which works with SystemD notify protocol
const { DgramSocket } = require("node-unix-socket");
const http = require("node:http");
/**
* Implements notify mechanism for systemd services which created with systemd.
*
* See all kinds of messages which can be sent to systemd
* https://man.archlinux.org/man/sd_notify.3.en#WELL-KNOWN_ASSIGNMENTS
*
* @param {string} message - The message to send
@huksley
huksley / onSubmit.gs
Created June 4, 2025 10:44
AppScript for Google Forms to handle onSubmit. Sends form responses to the URL, in this example to the Slack channel hook
// Your Slack webhook url
var webhookUrl = 'https://hooks.slack.com/services/.....';
/**
* Submit for forms "On form submit" event trigger (add in triggers)
*/
function onSubmit(e) {
var formTitle = FormApp.getActiveForm().getTitle();
var formUrl = FormApp.getActiveForm().getEditUrl();
var response = e.response.getItemResponses();
@huksley
huksley / nginx-extra.conf
Last active March 26, 2025 12:28
Exclude AI bots from nginx, but not block them, show the placeholder page instead about your website / SaaS
# Define a map of blocked user agents
map $http_user_agent $blocked_ua {
default 0;
"~*AI2Bot" 1;
"~*Ai2Bot-Dolma" 1;
"~*Amazonbot" 1;
"~*anthropic-ai" 1;
"~*Applebot" 1;
"~*Applebot-Extended" 1;
"~*Brightbot" 1;
@huksley
huksley / server.js
Created December 14, 2024 13:15
Custom NextJS 14 server, works with development mode and standalone builds.
/**
* Based on https://nextjs.org/docs/pages/building-your-application/configuring/custom-server
*/
/* eslint-disable @typescript-eslint/no-require-imports */
/* eslint-disable no-console */
/* eslint-disable @typescript-eslint/no-empty-function */
const { createServer } = require("node:http");
const { parse } = require("node:url");
@huksley
huksley / README.md
Last active November 29, 2024 12:06
Run minimal development postgres locally (MacOS)

Local postgres

It is so easy to run locally, and you don't need a docker for that!

Installing & running

brew install postgresql
git clone https://gist.github.com/huksley/f74e422424c03d8e37e5dc04a20f64eb pg
cd pg