Skip to content

Instantly share code, notes, and snippets.

I am slow to respond, ping me when it's crucial.

Michal Papis mpapis

I am slow to respond, ping me when it's crucial.
View GitHub Profile
mpapis / dr.rb
Last active June 19, 2018 22:52
Rename files with given prefix and a file index from sort by creation date
View dr.rb
#!/usr/bin/env ruby
require "mini_magick"
rescue LoadError => e
abort <<-MESSAGE
Missing `mini_magick`, try installing with:
sudo zypper in ruby2.5-rubygem-mini_magick
# OR
gem install mini_magick
View 57954.patch
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index 6144c67234..4aa388849b 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -536,7 +536,11 @@ static inline int rb_type(VALUE obj);
#ifdef __GNUC__
#define RB_GC_GUARD(v) \
- (*__extension__ ({volatile VALUE *rb_gc_guarded_ptr = &(v); rb_gc_guarded_ptr;}))
+ (*__extension__ ({ \
View DuckDuckGo.yaml
- _id: "[app]/DuckDuckGo.xml"
_name: DuckDuckGo
_hidden: false
description: Search DuckDuckGo
mpapis /
Created December 28, 2015 14:51
Remove Ruby from Gemfile to allow bisecting older code
sed -i "/ruby '2.2.2'/ s/^/#/" Gemfile
"$@" || result=$?
git checkout -- Gemfile
exit $result

Keybase proof

I hereby claim:

  • I am mpapis on github.
  • I am mpapis ( on keybase.
  • I have a public key whose fingerprint is 409B 6B17 96C2 7546 2A17 0311 3804 BB82 D39D C0E3

To claim this, I am signing this object:

View after_use_textmate
#!/usr/bin/env bash
# Automatically sets the wrappers for textmate's use
# Based on article posted:
# Set up the TM_RUBY shell variable as described and remove the Builder as described and restart TextMate
# Make this script executable and you should be good to go! TextMate will stay in sync with rvm, which
# generally means the last project folder you switched into from terminal shell.
if [[ $TM_WRAPPING != "1" ]]; then
View 45252.diff
--- a/ext/readline/readline.c (revision 45251)
+++ b/ext/readline/readline.c (revision 45252)
@@ -1883,7 +1883,7 @@
rl_attempted_completion_function = readline_attempted_completion_function;
- rl_pre_input_hook = (Function *)readline_pre_input_hook;
+ rl_pre_input_hook = (rl_hook_func_t *)readline_pre_input_hook;
mpapis / take_n.rb
Last active January 2, 2016 04:28
ruby vs shell
View take_n.rb
puts "2.10.3".split(".")[0..1].join(".")
mpapis / bad.rb
Last active January 1, 2016 22:49
I hate asymmetrical code
View bad.rb
apply_event :transfer_sent, :target_account_uid => target,
:amount => amount,
:new_balance => new_balance.amount,
:account_uid => uid