This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 "" }' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find -L . -type f -name "*.rhtml" | while read FNAME; do cp $FNAME `dirname $FNAME``echo '/'``basename $FNAME .rhtml`.html.erb; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def s3_form_tag(options = {}) | |
bucket = options[:bucket] | |
access_key_id = options[:access_key_id] | |
secret_access_key = options[:secret_access_key] | |
key = options[:key] || '' | |
content_type = options[:content_type] || '' # Defaults to binary/octet-stream if blank | |
redirect = options[:redirect] || '/' | |
acl = options[:acl] || 'public-read' | |
expiration_date = options[:expiration_date].strftime('%Y-%m-%dT%H:%M:%S.000Z') if options[:expiration_date] | |
max_filesize = options[:max_filesize] || 671088640 # 5 gb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get info about all Contexts in ldap | |
ldapsearch -x -H ldap://localhost -b "" -s base configContext namingContexts monitorContext | |
# display cn=config structures and data | |
ldapsearch -Y EXTERNAL -H ldapi:/// -b "cn=config" | |
# or | |
slapcat -b cn=config > config.ldiff | |
# modify config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# linux is awsome | |
# first.csv | |
# A | |
# B | |
# C | |
# D | |
# second.csv | |
# B |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for name in *.ogg; do ffmpeg -i "$name" "$name.mp3"; done; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fetch = +refs/pull/*/head:refs/remotes/origin/pr/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "1T" | sed -e 's/t/kg/i;s/g/km/i;s/m/kk/i;s/k/*1024/ig;s/b//i' | bc |
OlderNewer