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 / 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 / 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 / ruby_data_object_comparison.rb
Last active September 17, 2020 12:24 — forked from palexander/ruby_data_object_comparison.rb
Benchmark to compare hash, OpenStruct, struct, and classes in Ruby
require 'ostruct'
require 'benchmark'
COUNT = 10_000_000
NAME = "Test Name"
EMAIL = "[email protected]"
class Person
def initialize(name:, email:)
@name = name
@skatkov
skatkov / wip_graphql_demo.rb
Created May 2, 2018 07:40 — forked from marckohlbrugge/wip_graphql_demo.rb
Ruby example of creating a todo and then completing it using wip.chat graphql.
# NOTE: Be sure to set the API key further down in the code!
require "net/http"
require "uri"
require "json"
class WIP
def initialize(api_key:)
@api_key = api_key
end
class MiniTest::Spec
def self.shared_examples
@shared_examples ||= {}
end
end
module MiniTest::Spec::SharedExamples
def shared_examples_for(desc, &block)
MiniTest::Spec.shared_examples[desc] = block
end
@skatkov
skatkov / heroku_deploy.rake
Created October 17, 2012 21:31 — forked from michaeldwan/heroku_deploy.rake
Simple Rake task for customizing deployment to Heroku
# List of environments and their heroku git remotes
ENVIRONMENTS = {
:staging => 'myapp-staging',
:production => 'myapp-production'
}
namespace :deploy do
ENVIRONMENTS.keys.each do |env|
desc "Deploy to #{env}"
task env do
@skatkov
skatkov / youtube.rb
Created July 11, 2012 02:28 — forked from jamieowen/youtube.rb
Octopress Youtube plugin...
module Jekyll
class Youtube < Liquid::Tag
@width = 640
@height = 390
def initialize(name, id, tokens)
super
@id = id
end