Skip to content

Instantly share code, notes, and snippets.

Avatar

Alex Musayev dreikanter

View GitHub Profile
@dreikanter
dreikanter / README.md
Created Jun 15, 2022
A script to extract hashtags from stdin
View README.md

Usage example:

echo "#banana #banana #ololo #un_der-sco_re #по-русски #123" | ./extract_hashtags
#123
#banana
#ololo
#un_der-sco_re
#по-русски
@dreikanter
dreikanter / github_backup.md
Last active Mar 8, 2022
Keep your 🧳 together
View github_backup.md

Create Github access token: https://github.com/settings/tokens

Setup backup tool:

pip3 install github-backup

export GITHUB_BACKUP_TOKEN=ghp_bananabananabananabananabananabanana
export GITHUB_BACKUP_USER=dreikanter
export GITHUB_BACKUP_PATH=~/github-backup/$GITHUB_BACKUP_USER
@dreikanter
dreikanter / init.lua
Last active Dec 11, 2021
~/.hammerspoon/init.lua
View init.lua
-- hs.hotkey.bind({"cmd", "shift"}, "1", function()
-- hs.keycodes.setLayout("English - Ilya Birman Typography")
-- end)
-- hs.hotkey.bind({"cmd", "shift"}, "2", function()
-- hs.keycodes.setLayout("Russian - Ilya Birman Typography")
-- end)
hs.hotkey.bind({"cmd", "alt"}, "1", function()
hs.keycodes.setLayout("English - Ilya Birman Typography")
View purge_rubocop_todo.rb
require 'yaml'
data = YAML.load_file('.rubocop_todo.yml')
data.each do |cop, options|
excludes = options['Exclude']
next unless excludes
next if excludes.empty?
data[cop]['Exclude'] = excludes.select do |path|
View keybase.md

Keybase proof

I hereby claim:

  • I am dreikanter on github.
  • I am dreikanter (https://keybase.io/dreikanter) on keybase.
  • I have a public key ASDcuPip3Eglyl-q1S2l3xSMsVqRjw2h788AmWPn3FCK8Ao

To claim this, I am signing this object:

@dreikanter
dreikanter / monads.rb
Last active Aug 19, 2019
Trying dry-monads
View monads.rb
# #fmap - bypass Failure object, or return Success(result)
# #bind - bypass Failure object, or return result
require 'dry/monads'
require 'dry/monads/do'
class SequenceExecutor
include Dry::Monads[:result]
# This will prepend the class with a module, bypassinf a block to #call
@dreikanter
dreikanter / README.md
Last active Nov 9, 2017
Bookmarklet for GitHub Issues to filter the list issues closed during last 7 days
View README.md
@dreikanter
dreikanter / 1.js
Last active Jul 6, 2017
Extending Sprockets to Bundle Custom Assets Type
View 1.js
window.Templates = {
post: <h2>{{ title }}</h2> <p>{{ body }}</p>,
comment: “…”
}
@dreikanter
dreikanter / gem env
Created Jun 30, 2017
Comparing Ruby env vars
View gem env
# BrightBox
RubyGems Environment:
- RUBYGEMS VERSION: 2.6.11
- RUBY VERSION: 2.4.1 (2017-03-22 patchlevel 111) [x86_64-linux-gnu]
- INSTALLATION DIRECTORY: /var/lib/gems/2.4.0
- USER INSTALLATION DIRECTORY: /home/vagrant/.gem/ruby/2.4.0
- RUBY EXECUTABLE: /usr/bin/ruby2.4
- EXECUTABLE DIRECTORY: /usr/local/bin
- SPEC CACHE DIRECTORY: /home/vagrant/.gem/specs