Skip to content

Instantly share code, notes, and snippets.

View kigster's full-sized avatar
:octocat:
@repos.select { |r| r.is_a?(Gem) }.publish("https://rubygems.org")

Konstantin Gredeskoul kigster

:octocat:
@repos.select { |r| r.is_a?(Gem) }.publish("https://rubygems.org")
View GitHub Profile
@kigster
kigster / cursor-extension-importer.sh
Created January 22, 2025 02:59
Import VSCode Extensions into Cursor via CLI
#!/usr/bin/env bash
# vim: ft=bash
#
# © 2025 Konstantin Gredeskoul
# http://github.com/kigster | https://kig.re
#
# This script allows you to export the list of your VSCode
# extensions and import them into, eg. Cursor IDE. Or the
# other way around. By the default the script continues on
# import errors because there are typically quite a few.
@kigster
kigster / ruby-install
Last active February 18, 2025 20:20
Ruby Install Minimal script for MacOS and Linux. You can use it to install a recent Ruby using `rbenv` and `ruby-build`, with Jemalloc & YJIT enabled. Run it like so: `bash -c "$(curl -fsSL https://bit.ly/ruby-install-0-2-1)" -- 3.4.1`
#!/usr/bin/env bash
# vim: ft=bash
#
# © 2025 Konstantin Gredeskoul <kig AT kig.re>
# All rights reserved.
# MIT License.
#
# This script uses rbenv/ruby-build to install Ruby on OS-X or Linux. It configures
# Ruby build flags in such a way to ensure Ruby is linked with libjemalloc (which
# reduces the memory by half) and YJIT enabled. It has been tested on both Linux and
@kigster
kigster / logging_module.rb
Last active July 30, 2024 19:04
Ruby pattern for including a logging module everywhere you want. Just add “include Logging” at the top and you get both class and instance methods for logging such as #info, #debug, #error, #warn, #fatal. The threading at the bottom shows that the Logger is thread-safe and can be used without Mutexes.
# (c) 2024 Konstantin Gredeskoul
# Under the MIT License
#
# This gist documents a frequently thed pattern of decorating multiple classes with Logging methods
# by sharing just one Logger typically at the top of the module namespace (Application) in this case.
# If the concurrency issues come up, each class can be given its own logger, or perhaps the Logging moduloe
# might have decorators for each of the logging methods (eg #info, #debug) by using a Mutex.
#
# The output of this Ruby Code should be as follows:
@kigster
kigster / build-intellij-bazel.sh
Last active March 22, 2020 10:54
Basic build helper script for building IntelliJ Plugin from sources. See http://bit.ly/intellij-bazel-plugin-from-sources for more info.
#!/usr/bin/env bash
set -ex
function intellij::build() {
local intellij_product="$1" # eg, "intellij-ue-2019.3"
local shortcut=$(echo ${intellij_product} | sed 's/-.*$//g')
local plugin_base=
case $shortcut in
intellij)
@kigster
kigster / ruby-jemalloc-check.sh
Last active August 12, 2022 19:41
Detect if MRI Ruby is built with jemalloc library or not, download with `curl -fSL http://bit.ly/ruby-jemalloc-check > ruby-jemalloc-check.sh`
#!/usr/bin/env bash
# vi: ft=sh
#
# https://gist.github.com/kigster/8ddebf9fddff25620e64d558dd4d56b7
#
# © 2019-2022 Konstantin Gredeskoul, Inc., All rights reserved.
# MIT LICENSE
# ————————————————————————————————————————————————————————————————
# This script verifies that the ruby interpreter (either the one in
# the $PATH, or the one specified by the -r / --ruby option) is linked
@kigster
kigster / shell-set.sh
Created December 24, 2019 22:01
BASH functions to read values of set -e, -x, etc and be able to save them, and restore them later, eg. at the end of a function that wants to handle its errors.
#!/usr/bin/env bash
# ———————————————————————————————————————————————————————
# BashMatic Utilities Library
# ———————————————————————————————————————————————————————
# © 2017-2020 Konstantin Gredeskoul, All rights reserved.
#
# Distributed under the MIT LICENSE.
#
# Sources: https://github.com/kigster/bashmatic
# ———————————————————————————————————————————————————————
@kigster
kigster / ruby-with-bazel.md
Created November 26, 2019 22:05
RubyConf Australia Submission for 2020

Building Ruby Apps and Gems with Bazel and Monorepo

Elevator Pitch

You must have heard about mono-repos by now. It's all the rage. Google is doing it, AirBnB is doing it, — the list goes on. But: does it really make sense to put all of your Ruby Things in one basket? Even so, does Bazel build system deliver on its promises when applied to Ruby? Come and see!

Talk Format

30-45 minutes

@kigster
kigster / fabfilter-remover.sh
Created March 5, 2019 05:16
Script to find and remove FabFilter plugins on Mac OS-X. Requires Terminal usage.
#!/usr/bin/env bash
if [[ ! -L lib || ! -L bootstrap ]]; then
[[ -z $(which curl) ]] && {
printf "Curl is required for this operation. Please install it with\n"
printf "brew install curl\n"
exit 1
}
curl -fsSL "http://bit.ly/bashmatic-bootstrap" | /usr/bin/env bash
fi
@kigster
kigster / reduce-underscan.sh
Last active June 19, 2024 03:07
This shell script walks you through the steps required to change the monitor underscan or overscan value on OS-X, when the Display Preferences are not providing the underscan/overscan slider for a given display. This process was documented by Ishan Sharma here: http://ishan.co/external-monitor-underscan and is a part of BashMatic library.
#!/usr/bin/env bash
#
# Script to change underscan/overscan value of a monitor on OS-X.
# © 2016-2019 Konstantin Gredeskoul, distributed under the MIT License.
#
#———————————————————————————————————————————————————————————————————————————————————————————
# EXCEPT AS REPRESENTED IN THIS AGREEMENT, ALL WORK PRODUCT BY DEVELOPER IS PROVIDED "AS IS".
# OTHER THAN AS PROVIDED IN THIS AGREEMENT, DEVELOPER MAKES NO OTHER WARRANTIES, EXPRESS OR
# IMPLIED, AND HEREBY DISCLAIMS ALL IMPLIED WARRANTIES, INCLUDING ANY WARRANTY OF
# MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE.
@mnishiguchi
mnishiguchi / rails_friendly_forwarding.md
Last active April 29, 2024 13:25
Rails, Devise - Friendly forwarding after sign in or log in