Skip to content

Instantly share code, notes, and snippets.

# frozen_string_literal: true
module Memoizable
# Allows to define memoized methods with ease.
# Usage:
#
# class SomeService
# include Memoizable
#
# def initialize(customer_id)
# frozen_string_literal: true
module Callable
# Makes object callable.
# Instance method #call must be defined.
# Usage:
#
# class SomeService
# include Callable
#
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/denisoster/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
@denisoster
denisoster / pundit_adapter.rb
Created October 7, 2020 09:00
active_admin/pundit_adapter.rb
def scope_collection(collection, action = Auth::READ)
# # scoping is appliable only to read/index action
# # which means there is no way how to scope other actions
# Pundit.policy_scope!(user, namespace(collection))
# rescue Pundit::NotDefinedError => e
# if default_policy_class && default_policy_class.const_defined?(:Scope)
# default_policy_class::Scope.new(user, collection).resolve
# else
# raise e
# end
@denisoster
denisoster / keychron
Created October 16, 2020 12:06
Override keys
xkb_keymap {
xkb_types { include "complete" };
xkb_compat { include "complete" };
xkb_symbols { include "pc+us+ru:2+inet(evdev)" };
xkb_geometry { include "pc(pc105)" };
xkb_keycodes {
include "evdev+aliases(qwerty)"
<LWIN> = 64;

Troubleshooting

Versions differ on projects!

Whe using rmagick

Linux:
Need install imagemagick6

PKG_CONFIG_PATH='/usr/lib/imagemagick6/pkgconfig' gem install rmagick -v '2.13.4'
@denisoster
denisoster / proton_exec.sh
Created January 10, 2021 14:43
Run another exe file from steam proton
#!/bin/bash
game_id=$1
game_folder=$2
executable_file=$3
### Checks
if [ -z "$game_id" ] || [ -z "$game_folder" ] || [ -z "$executable_file" ]; then
echo "Example: ./proton_exec.sh 211600 thief_gold \$HOME/executable_file.exe"
@denisoster
denisoster / start.sh
Last active March 2, 2022 12:12
Arch QEMU KVM Libvirt Single GPU PCI
#
#
# /etc/libvirt/hooks/qemu.d/winnvme/prepare/begin/start.sh
#
#
#!/bin/bash
set -x
# Stop display manager
@denisoster
denisoster / PKGBUILD
Created July 23, 2022 12:44
Podman with support Name Service Switch
# Maintainer: Morten Linderud <foxboron@archlinux.org>
# Maintainer: David Runge <dvzrv@archlinux.org>
# Contributor: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
pkgbase=podman
pkgname=(podman podman-docker)
pkgver=4.1.1
pkgrel=3
pkgdesc='Tool and library for running OCI-based containers in pods'
arch=(x86_64)