Skip to content

Instantly share code, notes, and snippets.

View trddddd's full-sized avatar

Roman Kirpichnikov trddddd

  • Russia, Saint-Petersburg
View GitHub Profile
@trddddd
trddddd / rvm.sh
Created August 22, 2023 16:23 — forked from umantsev/rvm.sh
Install RVM for Apple M2
brew install [email protected]
export PATH="$(brew --prefix)/opt/[email protected]/bin:$PATH"
export LDFLAGS="-L$(brew --prefix)/opt/[email protected]/lib"
export CPPFLAGS="-I$(brew --prefix)/opt/[email protected]/include"
export PKG_CONFIG_PATH="$(brew --prefix)/opt/[email protected]/lib/pkgconfig"
rvm autolibs disable
export RUBY_CFLAGS=-DUSE_FFI_CLOSURE_ALLOC

OpenBSD logo     Rails logo     Falcon logo


Choose OpenBSD for your Unix needs. OpenBSD -- the world's simplest and most secure Unix-like OS. A safe alternatve to the frequent vulnerabilities and overengineering of Linux and related software (NGiNX & Apache (httpd-asiabsdcon2015.pdf), OpenSSL, iptables/nftables, systemd, BIND, Postfix, Docker etc.)

OpenBSD -- the cleanest kernel, the cleanest userland and the cleanest config

@trddddd
trddddd / toggle-virtualization.bat
Created June 18, 2022 14:47 — forked from jonpulsifer/toggle-virtualization.bat
Virtualization must be disabled to use CS:GO anti-cheat clients like FACEIT and ESEA, but I like to use WSL2 and Docker, and this script helps me do that
@echo off
echo Virtualization must be disabled to use anti-cheat clients like FACEIT and ESEA
echo.
net session >nul 2>&1
if %ERRORLEVEL% EQU 0 goto :chchchchoices
echo This script requires elevated privileges. Re-run as Administrator to continue
goto :exit
:chchchchoices
@trddddd
trddddd / aws-yandex.rb
Created December 23, 2020 19:07
how to connect to storage.yandexcloud.net ruby
require 'aws-sdk'
Aws.config.update(
region: 'ru-central1',
credentials: Aws::Credentials.new('', '')
)
s3 = Aws::S3::Client.new(endpoint: "https://storage.yandexcloud.net")
resp = s3.list_buckets
resp.buckets.map(&:name)
class QueDaemon
attr_reader :queues_config, :pid, :forks
SECONDS_FOR_SOFT_SHUTDOWN = 5
def initialize(queues_config)
@queues_config = queues_config
@pid = Process.pid
@workers = {}
end
class Daemons
def initialize
@num_worker = 3
@worker_pids = []
@signal_queue = []
@handle_signals = %i[INT CLD]
@self_pipe_reader, @self_pipe_writer = IO.pipe
end
def start
@trddddd
trddddd / partitions.sql
Last active July 31, 2020 09:29
A recursive CTE to get all nested partitions for table for Postgresql (without original table)
WITH RECURSIVE nested_partitions (
relid,
relname,
relispartition,
relkind
) AS (
SELECT
inhrelid,
child.relname,
child.relispartition,
@trddddd
trddddd / rails-jsonb-queries
Created June 2, 2020 12:07 — forked from mankind/rails-jsonb-queries
Rails-5 postgresql-9.6 jsonb queries
http://stackoverflow.com/questions/22667401/postgres-json-data-type-rails-query
http://stackoverflow.com/questions/40702813/query-on-postgres-json-array-field-in-rails
#payload: [{"kind"=>"person"}]
Segment.where("payload @> ?", [{kind: "person"}].to_json)
#data: {"interest"=>["music", "movies", "programming"]}
Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json)
Segment.where("data #>> '{interest, 1}' = 'movies' ")
Segment.where("jsonb_array_length(data->'interest') > 1")
@trddddd
trddddd / rutube-list-downloader.rb
Last active May 30, 2020 23:13
Rutube list video grabber
# smell code and idea for clear gem :)
# todo: wrap to gem, parse m3u8, ts downloader to file
require 'httparty'
class RutubeList
APIS =
{
login: 'https://pass.rutube.ru/api/accounts/phone/login/',
login_social: 'https://rutube.ru/social/auth/rupass/?callback_path=/social/login/rupass/',
visitor: 'https://rutube.ru/api/accounts/visitor/',