Skip to content

Instantly share code, notes, and snippets.

View bibendi's full-sized avatar

Misha Merkushin bibendi

View GitHub Profile
@bibendi
bibendi / .zshrc
Last active December 24, 2021 07:15
Dual architecture on M1 Apple Silicon
# Homebrew
_ARCH=$(arch)
PROMPT="$_ARCH $PROMPT"
if [[ "$_ARCH" == "i386" ]]; then
local brew_path="/usr/local/homebrew/bin"
local brew_opt_path="/usr/local/homebrew/opt"
local nvm_path="$HOME/.nvm-x86"
local rbenv_path="$HOME/.rbenv-x86"
fi
if [[ "$_ARCH" == "arm64" ]]; then
@bibendi
bibendi / installing-ruby-2.5.1-on-m1.md
Created December 22, 2021 09:16 — forked from MarkBennett/installing-ruby-2.5.1-on-m1.md
Installing Ruby 2.5 on Mac M1
@bibendi
bibendi / db.rake
Created November 9, 2021 06:45
Disabling schema dumping for the statistics database on Rails 6.
raise "Remove patches below in Rails 7" if Rails::VERSION::MAJOR == 7
Rake::Task["db:schema:load:statistics"]&.clear
Rake::Task["db:_dump:statistics"]&.clear
Rake::Task["db:schema:dump:statistics"]&.clear
Rake::Task["db:test:load_schema:statistics"]&.clear
namespace :db do
namespace :schema do
desc "Creates a database schema file (either db/schema.rb or db/structure.sql, depending on `config.active_record.schema_format`)"
task dump: :load_config do
namespace :db do
namespace :bloat do
desc 'Поиск распухших таблиц'
task :tables => :environment do
redis = Redis::Namespace.new('db:bloat')
connection = ActiveRecord::Base.connection
connection.tables.each do |table_name|
begin
rows_counted = redis.hget('tables', table_name)
class MutationRoot < Common::GraphQL::MutationRoot
with_options authenticate: true do
field :create_direct_upload, mutation: Mutations::CreateDirectUpload
end
with_options authenticate: true, user_checks: {completed: true} do
field :follow_user, mutation: Mutations::FollowUser
field :unfollow_user, mutation: Mutations::UnfollowUser
end
end
# frozen_string_literal: true
module CoreBy
module FieldExtensions
# GraphQL field extension allows returning URL of Active Storage attachment.
# TODO: Move to `graphql-field_attachment` gem?
class AttachmentUrlField < GraphQL::Schema::FieldExtension
attr_reader :attachment_assoc
def apply
@bibendi
bibendi / rkn_unblock.md
Created November 7, 2019 19:37 — forked from furdarius/rkn_unblock.md
Настройка обхода РКН на роутере
@bibendi
bibendi / README.md
Created April 16, 2019 14:45 — forked from seebk/README.md
Extract embedded certificates and keys from OpenVPN config files

This python script is intended to automate the extraction of embedded certificates and keys from OpenVPN config files.

Unfortunately the GNOME Network-Manager is not able to automatically import OpenVPN config files with embedded certificates and keys. A workaround is to manually extract these and store them in separate files (e.g. see https://naveensnayak.wordpress.com/2013/03/04/ubuntu-openvpn-with-ovpn-file/).

Instructions:

  • Make shure all the required packages are installed. For example on Ubuntu and Debian run:

    $ sudo apt-get install python3 network-manager-openvpn-gnome

@bibendi
bibendi / unwatch.rb
Last active November 1, 2018 17:34
Unwatch all Organization's repositories
require "octokit"
client = Octokit::Client.new(access_token: "")
client.auto_paginate = true
client.organization_repositories('abak-press', type: 'all').each do |repo|
client.delete_subscription(repo.id)
client.forks(repo.id).each do |fork|
client.delete_subscription(fork.id)
@bibendi
bibendi / .pryrc
Last active December 5, 2023 12:52
Dip on Rails
Pry.config.history.should_save = true
Pry.config.history.file = File.join(__dir__, '.pry_history')