Skip to content

Instantly share code, notes, and snippets.

Avatar
🙃
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
mpapis / dr.rb
Last active Jun 19, 2018
Rename files with given prefix and a file index from sort by creation date
View dr.rb
#!/usr/bin/env ruby
begin
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
__searchForm:
_iconURL: data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAB8lBMVEUAAADkRQzjPwPjQQXkRQ3iPwTiQQXgPQPeQgrcOwPVNgDVNQDWOgbTMwDRMgDQMwDSMwDRNwTQLgDRJgDSJwDSLgDSNwTjOgDiOADjOQDkPADhQAXzs5v+/fv////0vKbiRQvgPQHpdUr85NzuknPdKgDcIwDnZzj2w7HqeU/gPQLsimb/+PftjWn97Obpb0LdJQDeLQDtjmvsi2jgSBDnbULgOQD/39HgLQDeMgDpeFLgSBH0v670uqbaJQD2qImWvP/G1Ob5+/3u//+fvvXyp47dMwDaLwD0u6v0v6/aNQDiXi/aKQD3qozU7/8gSY2vvtg0ZK/OqLDaKQHYKgLgWTfaNADZMgDZMADZLADzqpD7//+xwdz//9H/5Bn/7Bn//ADofADYMADYMQDZOgPXLgDiZDj//97/0AD3tQDvlgHZOgbXLATXMADWMgDfXjLVLQD///z+0AD/3Rn/yRnwnQDcVjbVMQDyv67wuKTSJwDRHQD+8O/tg3/iQQDwhAHnawHWMADvtKfyva7XQxHga0bQGQD2vbH/u8LXIQCmPQzja07XQxLliGn99fPkcVHvhnGZ5VguvUU5wktBwCcAgxzydVv/8/XmiGngdlL+ysi3+I8LtCE80V6P3YmX4sDleljSNQLzr6D7sKPXNQTSIwAEAbMrAAAAF3RSTlMARqSkRvPz80PTpKRG3fPe3hio9/eoGP
@mpapis
mpapis / remove_ruby_from_gemfile.sh
Created Dec 28, 2015
Remove Ruby from Gemfile to allow bisecting older code
View remove_ruby_from_gemfile.sh
result=0
sed -i "/ruby '2.2.2'/ s/^/#/" Gemfile
"$@" || result=$?
git checkout -- Gemfile
exit $result
View keybase.md

Keybase proof

I hereby claim:

  • I am mpapis on github.
  • I am mpapis (https://keybase.io/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 speaker.md
View after_use_textmate
#!/usr/bin/env bash
#
# Automatically sets the wrappers for textmate's use
# Based on article posted: http://www.christopherirish.com/2010/06/28/how-to-setup-textmate-to-use-rvm/
# 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;
#if defined(HAVE_RL_PRE_INPUT_HOOK)
- rl_pre_input_hook = (Function *)readline_pre_input_hook;
+ rl_pre_input_hook = (rl_hook_func_t *)readline_pre_input_hook;
#endif
#ifdef HAVE_RL_CATCH_SIGNALS
@mpapis
mpapis / take_n.rb
Last active Jan 2, 2016
ruby vs shell
View take_n.rb
puts "2.10.3".split(".")[0..1].join(".")
@mpapis
mpapis / bad.rb
Last active Jan 1, 2016
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