Skip to content

Instantly share code, notes, and snippets.

View karavanis's full-sized avatar

Konstantinos Aravanis karavanis

  • Leonteq Securities AG
  • Zurich, Switzerland
View GitHub Profile
def specialFrenchGermanCharactersToBase64(str: String) = {
str.replaceAll("À", "%C3%80")
.replaceAll("Â", "%C3%82")
.replaceAll("Ç", "%C3%87")
.replaceAll("É", "%C3%89")
.replaceAll("È", "%C3%88")
.replaceAll("Ê", "%C3%8A")
.replaceAll("Ë", "%C3%8B")
.replaceAll("Î", "%C3%8E")
.replaceAll("Ï", "%C3%8F")
@karavanis
karavanis / sidekiq_queue_load.rb
Created July 31, 2014 08:26
Ruby script to get the queue load on Sidekiq
loop do
Sidekiq::Client.registered_queues.each do |q|
Sidekiq.redis do |r|
puts "#{q} #{r.lrange("queue:#{q}", 0, -1).size}"
end
end
sleep(10)
puts "\e[H\e[2J"
end
@karavanis
karavanis / commit-msg
Last active August 29, 2015 13:57 — forked from codesnik/commit-msg
#!/usr/bin/env ruby
#
# Git commit-msg hook. If your branch name is in the form "SYSRAP-123", automatically
# adds "Refs #SYSRAP-123." to commit messages unless they mention "#SYSRAP-123" already.
#
# By Henrik Nyh <http://henrik.nyh.se> 2009-09-10 under the MIT License.
#
#
# Install:
#
#!/usr/bin/env ruby
require 'csv'
require 'json'
if ARGV.size != 2
puts 'Usage: csv_to_json input_file.csv output_file.json'
puts 'This script uses the first line of the csv file as the keys for the JSON properties of the objects'
exit(1)
end
# self
class Foo
# self
# belongs_to
def Foo.foo
@bla = '123'
puts 'bla'
end
module V1A
def mpla
"#{foo} from mpla"
end
def foo
return 'from V1'
end
end