Skip to content

Instantly share code, notes, and snippets.

View adis-io's full-sized avatar

Adis Osmonov adis-io

View GitHub Profile
@palkan
palkan / frame_display.rb
Last active November 2, 2021 15:32
tcpdump -> pretty http2 packets
# frozen_string_literal: true
# Example usage:
#
# tcpdump -i lo0 'port 3010' -v -X -l | ruby frame_display.rb
#
require 'bundler/inline'
gemfile(true, quiet: true) do
source 'https://rubygems.org'
@vanadium23
vanadium23 / pocket-counters.js
Last active July 12, 2022 14:48
Script for tampermonkey to add articles count in selection list (My list, archive, favorites)
// ==UserScript==
// @name Pocket Counters
// @namespace http://vanadium23.me/
// @version 0.5
// @description Add counters to pocket list
// @author vanadium23
// @match https://app.getpocket.com/*
// @ran-at document-idle
// @grant none
// ==/UserScript==
require 'benchmark'
require 'benchmark/memory'
require 'dry-struct'
require 'dry-initializer'
require 'virtus'
require 'shallow_attributes'
require 'active_data'
require 'active_model'
require 'benchmark/ips'
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
gemfile(true) do
source "https://rubygems.org"
@adis-io
adis-io / json_api_client_vs_her_rb.md
Last active April 22, 2017 08:48
JsonApiClient vs Her Rb for using with json_api

JsonApiClient

Pros

Cons

Her Rb

Pros

@keithpitt
keithpitt / database_state_loader.rb
Last active June 10, 2022 16:32
Note that this code only works with PostgreSQL, but it wouldn’t be too hard to adapt our approach for other relational databases.
# Add to `spec/support/database_state_loader.rb`
class DatabaseStateLoader
class EnvironmentError < RuntimeError; end
def self.load(path)
new(path).load
end
def initialize(path)
@wojteklu
wojteklu / clean_code.md
Last active May 8, 2024 09:54
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@gwillem
gwillem / ansible-bootstrap-ubuntu-16.04.yml
Created June 16, 2016 21:59
Get Ansible to work on bare Ubuntu 16.04 without python 2.7
# Add this snippet to the top of your playbook.
# It will install python2 if missing (but checks first so no expensive repeated apt updates)
# gwillem@gmail.com
- hosts: all
gather_facts: False
tasks:
- name: install python 2
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)