Skip to content

Instantly share code, notes, and snippets.

View zinovyev's full-sized avatar

Zinovyev Ivan zinovyev

View GitHub Profile
@zinovyev
zinovyev / awesome-luajit.md
Last active February 8, 2024 10:21
Compiling Awesome WM with LuaJIT
@zinovyev
zinovyev / rpmtoarch
Created November 8, 2018 14:21
Convert rpm package to Archlinux package (makepkg -s command required afterwards)
#!/usr/bin/env ruby
require "fileutils"
class Package
FILTERED_PARTS = %w[rpm x86_64]
INSTALL_SECTIONS = %w[pre_install post_install pre_upgrade
post_upgrade pre_remove post_remove].freeze
@zinovyev
zinovyev / tt
Last active July 19, 2023 14:25
Create directory and file paths recursively
#! /usr/bin/env bash
# Create file or directory with parent directories
# For a more detalied description please take a look at:
# https://zinovyev.net/blog/create-files-and-directories-with-parent-directories
HELP_MESSAGE=$(cat <<EOM
Create files or directories with underlying path
Usage Examples:
@zinovyev
zinovyev / git-daemon.service
Created May 15, 2016 13:20
/etc/systemd/system/git-daemon.service to start and enable git-daemon via systemd
[Unit]
Description=Git Repositories Server Daemon
Documentation=man:git-daemon(1)
[Service]
# Ignore non-zero exit status, access error makes git-daemon return them
ExecStart=/usr/bin/git daemon \
--user=git --group=git \
--reuseaddr \
--base-path=/opt/git/ \
@zinovyev
zinovyev / esets.sh
Last active July 1, 2022 05:47
Kill all esets processes on Mac
#! /usr/bin/env bash
ps -A | grep eset | grep -v grep
killall -m .*eset.*
@zinovyev
zinovyev / gitlab-runner-commands.sh
Last active May 24, 2022 11:19
Unregister gitlab runner
## Remove a runner
sudo gitlab-runner list # To get a list of existing runners
sudo gitlab-runner verify --delete --url $YOUR_GITLAB_DOMAIN --token $YOUR_GITLAB_RUNNER_TOKEN
## Register a docker runner
sudo gitlab-runner register \
--non-interactive \
@zinovyev
zinovyev / webpacker_helper.rb
Created March 28, 2019 21:34
Rails helper for loading controller specific assets managed by Webpacker
module WebpackerHelper
def page_pack_tags
join_paths(application_pack_tags,
controller_pack_tags)
end
def application_pack_tags
join_paths(attempt_to_find(:stylesheet, 'application'),
attempt_to_find(:javascript, 'application'))
end
@zinovyev
zinovyev / 20-intel.conf
Created October 17, 2019 06:55
Fix video tearing on Thinkpad t480 with Archlinux on board /etc/X11/xorg.conf.d/20-intel.conf
Section "Device"
Identifier "Intel Graphics"
Driver "intel"
Option "TearFree" "true"
Option "AccelMethod" "uxa"
EndSection
@zinovyev
zinovyev / kafka commands
Last active February 6, 2020 13:32
kafka base commands
# Create a topic
kafka-topics --create --bootstrap-server localhost:9092 --topic test --partitions 1 --replication-factor 1
# List existend topics
kafka-topics --list --bootstrap-server localhost:9092
# Start a consumer
kafka-console-consumer --bootstrap-server localhost:9092 --topic test --from-beginning
# Start a producer
@zinovyev
zinovyev / convenient_hours.rb
Created September 4, 2019 14:09
Find out wich hours are convenient for the meeting for different people working from the defferent timezones: `ruby convenient_hours.rb +2 +3 +8`
#! /usr/bin/env ruby
def format_time_zone(tz)
format('%06.2f', tz.gsub(/:/, '.')).gsub(/^0/, '+').gsub(/\./, ':')
end
TIMEZONES = ARGV.map { |tz| format_time_zone(tz) }.freeze
WORKING_HOURS = (7..19).freeze