Skip to content

Instantly share code, notes, and snippets.

View ritxi's full-sized avatar
🎗️

Ricard Forniol ritxi

🎗️
  • Sage
  • Sabadell, República Catalana
View GitHub Profile
@ritxi
ritxi / Script output with mongo 2.6
Last active September 25, 2019 06:19
Cursors not being closed after iteration
D, [2019-09-25T08:11:47.351640 #99034] DEBUG -- : MONGODB | 127.0.0.1:27017 | admin.insert | STARTED | {"insert"=>"test", "documents"=>[{"a"=>0.8066219628621961, "_id"=>BSON::ObjectId('5d8b05239bc38582daab80a7')}], "ordered"=>true}
D, [2019-09-25T08:11:47.351912 #99034] DEBUG -- : MONGODB | 127.0.0.1:27017 | admin.insert | SUCCEEDED | 0.000s
D, [2019-09-25T08:11:47.352277 #99034] DEBUG -- : MONGODB | 127.0.0.1:27017 | admin.serverStatus | STARTED | {"serverStatus"=>1}
D, [2019-09-25T08:11:47.353111 #99034] DEBUG -- : MONGODB | 127.0.0.1:27017 | admin.serverStatus | SUCCEEDED | 0.001s
noTimeout cursors before iteration: 0
D, [2019-09-25T08:11:47.353758 #99034] DEBUG -- : MONGODB | 127.0.0.1:27017 | admin.find | STARTED | {"find"=>"test", "filter"=>{}, "batchSize"=>10, "noCursorTimeout"=>true}
D, [2019-09-25T08:11:47.354139 #99034] DEBUG -- : MONGODB | 127.0.0.1:27017 | admin.find | SUCCEEDED | 0.000s
D, [2019-09-25T08:11:47.354506 #99034] DEBUG -- : MONGODB | 127.0.0.1:27017 | admin.getMore | STARTED | {"getMo
@ritxi
ritxi / .rspec
Created May 13, 2016 09:04
Custom Gemfile dependencies injection
--color
--require spec_helper
--require ~/.unbundled_require
--format Fuubar
@ritxi
ritxi / file_server.sh
Created July 3, 2015 07:09
Share a folder throw http
ruby -run -e httpd . -p 9090
@ritxi
ritxi / security.sh
Created July 1, 2015 14:12
Encrypt/Decrypt files
# Encrypt file
openssl enc -in file.tar.bz2 -out file.tar.bz2.enc -e -aes256 -k password
# Decrypt file
openssl enc -in file.tar.bz2.enc -out file.tar.bz2 -d -aes256 -k password
@ritxi
ritxi / _steps.html.haml
Last active August 29, 2015 13:56
Wizzard with bootstrap
.wizard
= step(1, 'Inscripció')
= step(2, 'Verificació')
= step(3, 'Pagament')
= step(4, 'Final')
@ritxi
ritxi / 0-readme.md
Created December 6, 2012 19:39 — forked from burke/0-readme.md
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

require 'test_helper'
class DecrypterTest < Test::Unit::TestCase
include InformationCard
def test_should_decrypt_encrypted_xml_token_into_saml_token
decrypter = Decrypter.new(
load_encrypted_information_card('wuaki.xml'),certificates_directory,
'/O=testinformationcardruby.com/CN=*.wuaki.tv')
puts decrypter.decrypt
@ritxi
ritxi / gist:2311731
Created April 5, 2012 14:56 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@ritxi
ritxi / gist:1647628
Created January 20, 2012 14:37
git color
c_cyan=`tput setaf 6`
c_red=`tput setaf 1`
c_green=`tput setaf 2`
c_sgr0=`tput sgr0`
branch_color ()
{
if git rev-parse --git-dir >/dev/null 2>&1
then
color=""
@ritxi
ritxi / Replaceable.rb
Created October 3, 2011 09:51
Replaceable module for ruby String class
module Replaceable
def self.include_me!(_class)
_class.class_eval do
include Replaceable
end
end
def replace_values!(locals)
locals.each{ |key, val| self.gsub!("%%#{key.to_s.upcase}%%", val) }
self