Skip to content

Instantly share code, notes, and snippets.

View skatkov's full-sized avatar
🏠
Working from home

Stanislav (Stas) Katkov skatkov

🏠
Working from home
View GitHub Profile
@skatkov
skatkov / settings.json
Last active April 20, 2025 17:05
zed.settings.json
{
"ui_font_family": "FiraCode Nerd Font Mono",
"buffer_font_family": "FiraCode Nerd Font Mono",
"theme": {
"mode": "system",
"light": "Alabaster",
"dark": "One Dark"
},
"lsp": {
"golangci-lint": {
@skatkov
skatkov / choosy
Last active January 12, 2025 16:31 — forked from cesarolea/choosy
Open browser based off of certain rules (like choosy for macOS)
#!/bin/bash
URL=$1
DOMAIN=$(echo "$URL" | awk -F[/:] '{print $4}')
# Read the list of domains from the file
DOMAIN_LIST=$(cat /home/sk/.config/url-list.txt)
# Check if the domain is in the list
if echo "$DOMAIN_LIST" | grep -q "$DOMAIN"; then
@skatkov
skatkov / pull_request_template.md
Created September 14, 2024 21:15
Pull Requst Template

What

Replace this with a description of the changes that you are making. To help reviewers easily understand the changes, please add before/after screenshots or a short demo video recording of the feature/bugfix here.

Why

Replace this with a reason for the changes you are making.

Checklist

@skatkov
skatkov / create_pr.sh
Last active September 14, 2024 21:17 — forked from slavingia/create_pr.sh
Create a (draft) pull request using GitHub CLI
#!/bin/bash
# Create a (draft) pull request using GitHub CLI.
# It assigns the PR to the current user, fills in the title from the first commit,
# and uses the PR template file for the description.
set -euo pipefail
# Colors for output
RED='\033[0;31m'
@skatkov
skatkov / class_load_detector.rb
Created June 22, 2024 22:46
Detect when class was loaded
loader.on_load("MyDynamicClass") do |klass, _abspath|
puts "MyDynamicClass was loaded and now we can do stuff with it"
klass.prepend(MyFix)
end
@skatkov
skatkov / forever.sh
Created November 28, 2023 10:48
run tests forever (until they fail)
while bundle exec rake test; do :; done
@skatkov
skatkov / spellcheck.yml
Created May 25, 2023 21:36
Spell Checking with codespell and misspell
name: Spell Checking
on: [pull_request]
jobs:
codespell:
name: Check spelling with codespell
runs-on: ubuntu-latest
strategy:
matrix:
@skatkov
skatkov / application_job.rb
Created May 11, 2023 13:54
Store sample of sql when ActiveRecord::QueryCanceled occured
class ApplicationJob < ActiveJob::Base
include ActiveSupport::Rescuable
# PG::QueryCanceled will be wrapped with ActiveRecord::QueryCanceled errors and it's a direct
# descendant of ActiveRecord::StatementInvalid error.
rescue_from ActiveRecord::StatementInvalid do |exception|
# It's hard to know, on which queries we're seeing statement timeouts -- so we are making this explicit in AppSignal error.
Appsignal::Transaction.current.set_sample_data("custom_data", sql_statement: exception.sql)
raise exception
end
@skatkov
skatkov / test.rb
Last active January 3, 2024 18:20
speed up testsuit by using unlogged tables in PG
# config/environments/test.rb
ActiveSupport.on_load(:active_record_postgresqladapter) do
# For this optimization to work, you need to recreate your test database
self.create_unlogged_tables = true
end
@skatkov
skatkov / schema.sql
Created September 2, 2022 18:21
contact book
CREATE TABLE people ( id INTEGER PRIMARY KEY AUTOINCREMENT, first_name TEXT NOT NULL, last_name TEXT, dob TEXT, name TEXT, photo TEXT, notes TEXT);
CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE IF NOT EXISTS "contacts" (
"id" integer NOT NULL,
"type" text NOT NULL CHECK(type in ('work', 'mobile', 'home', 'email')),
"value" text NOT NULL,
"people_id" integer NOT NULL,
PRIMARY KEY("id" AUTOINCREMENT),
FOREIGN KEY("people_id") REFERENCES "people"("id"),
UNIQUE("type","value")