Skip to content

Instantly share code, notes, and snippets.

@mitfik
mitfik / gist:2405962
Created April 17, 2012 13:26
Show memory usage on Linux for human
ps -eo size,pid,user,command --sort -size | awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }'
@mitfik
mitfik / theme.rb
Created April 2, 2012 10:02
Redmine specify theme per project
module ApplicationHelper
def current_theme
# path to use diffrent theme for project and subprojects
unless instance_variable_defined?(:@current_theme)
theme = Setting.ui_theme
if not @project.nil?
if @project.root?
if File.directory?("#{Rails.public_path}/themes/#{@project.identifier}")
theme = @project.identifier
end
@mitfik
mitfik / ruby_csr_example.rb
Created February 27, 2012 10:13
Ruby example of CSR with openssl
require 'openssl'
def gen_key(name)
key = OpenSSL::PKey::RSA.new 1048
file = File.new(name, "w")
file.write(key)
file.close
end
def get_key(name)