Skip to content

Instantly share code, notes, and snippets.

@evaldasg
evaldasg / curl-cheatsheet.md
Created October 31, 2023 13:50
CURL cheatsheet

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@evaldasg
evaldasg / kill_sidekiq_job.rb
Created October 11, 2023 09:39 — forked from Chocksy/kill_sidekiq_job.rb
Kill sidekiq jobs by process id for busy jobs and by jid for other sets.
# FOR BUSY JOBS
# take the process_id from the /busy page in sidekiq and kill the longest running one.
workers = Sidekiq::Workers.new
long_process_id = 'integration.3:4:71111aaa111' # Eg: 'integration.3:4:71d1d7f4ef5a'
workers.each do |process_id, thread_id, work|
process = Sidekiq::Process.new('identity' => process_id)
process.stop! if process_id == long_process_id
end
# FOR SCHEDULED JOBS
@evaldasg
evaldasg / gpg-setup.md
Created October 2, 2023 17:16
GPG Setup
@evaldasg
evaldasg / pgp-public-key.txt
Created October 2, 2023 07:45
PGP Public Key
-----BEGIN PGP PUBLIC KEY BLOCK-----
mDMEZRpcKBYJKwYBBAHaRw8BAQdAmFRh8xwE/auGgZhORGN7ksoG7bM1XBDZphSh
cLU+SZi0R0V2YWxkYXMgR3J1ZHppbnNrYXMgKFdvcmsgcmVsYXRlZCBHUEcpIDxl
dmFsZGFzLmdydWR6aW5za2FzQHZpbnRlZC5jb20+iJMEExYKADsWIQTsIexNmgDM
Oh8fVcPAUmrgMWv9eAUCZRpcKAIbAwULCQgHAgIiAgYVCgkICwIEFgIDAQIeBwIX
gAAKCRDAUmrgMWv9eBsSAQDU599XYABlZ8F0qsx5FocMcU9xiGmzOeHH1LPXNKS6
wwD9EAqMOghFbc7dxR3tHvOpecwAjmaoB3xZZvbiEEWG3w+4OARlGlwoEgorBgEE
AZdVAQUBAQdAK+7Pdy49yOw6LpTM3pGUDnqvo1PxnYTq+BR2FqhmvEIDAQgHiHgE
GBYKACAWIQTsIexNmgDMOh8fVcPAUmrgMWv9eAUCZRpcKAIbDAAKCRDAUmrgMWv9
# Download and install the public signing key:
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg
# Install the apt-transport-https packages
sudo apt-get install apt-transport-https
@evaldasg
evaldasg / Netfilter-IPTables-Diagrams.md
Created May 23, 2023 14:05 — forked from nerdalert/Netfilter-IPTables-Diagrams.md
Linux NetFilter, IP Tables and Conntrack Diagrams

Linux NetFilter, IP Tables and Conntrack Diagrams

IPTABLES TABLES and CHAINS

IPTables has the following 4 built-in tables.

1) Filter Table

Filter is default table for iptables. So, if you don’t define you own table, you’ll be using filter table. Iptables’s filter table has the following built-in chains.

@evaldasg
evaldasg / serializer_benchmarks.rb
Created October 26, 2020 07:36 — forked from aishfenton/serializer_benchmarks.rb
Performance comparison of different ruby serializer methods
# sudo gem install bson
# sudo gem install bson_ext
# sudo gem install yajl-ruby
# sudo gem install json
# sudo gem install msgpack
require 'rubygems'
require 'benchmark'
require 'yaml'
require 'bson'

ganked from unreadable scribd doc here: http://cleancoder.posterous.com/what-killed-waterfall-could-kill-agile

What Killed Waterfall could Kill Agile.

Robert C. Martin
20 Nov, 2010

In 1970 a software engineer named Dr. Winston W. Royce wrote a seminal paper entitled Managing the Development of Large Software Systems. This paper described the software process that Royce felt was appropriate for large-scale systems. As a designer for the Aerospace industry, he was uniquely qualified.

He began the paper by setting up a straw-man process to knock down. He described this naïve process as “grandiose”. He depicted it with a simple diagram on an early page of his paper. Then the paper methodically tears this “grandiose” process apart. In the end, Royce proposed a far more nuanced and insightful approach, leaving the reader to giggle at the silliness of the “grandiose” model.

@evaldasg
evaldasg / ar_migrate.rb
Created March 4, 2019 16:39 — forked from icyleaf/ar_migrate.rb
ActiveRecord type of integer (tinyint, smallint, mediumint, int, bigint)
# activerecord-3.0.0/lib/active_record/connection_adapters/mysql_adapter.rb
# Maps logical Rails types to MySQL-specific data types.
def type_to_sql(type, limit = nil, precision = nil, scale = nil)
return super unless type.to_s == 'integer'
case limit
when 1; 'tinyint'
when 2; 'smallint'
when 3; 'mediumint'
when nil, 4, 11; 'int(11)' # compatibility with MySQL default
@evaldasg
evaldasg / install_mysql2.sh
Created January 30, 2019 07:00
Install mysql2 gem when using mysql@5.7 from brew
gem install mysql2 -v '0.4.4' -- \
--with-mysql-lib=$(brew --prefix mysql@5.7)/lib \
--with-mysql-dir=$(brew --prefix mysql@5.7) \
--with-mysql-config=$(brew --prefix mysql@5.7)/bin/mysql_config \
--with-mysql-include=$(brew --prefix mysql@5.7)/include