rake _0.8.7_ db:migrate
“git equivalent” for “svn update”
Using git just like svn? …
No branches, no tags, no stashing, just commit & push all day? 🙂
In this case, the following may apply:
svn update == git pull origin master
free online android emulators
https://app.manymo.com/emulators
Thanks guys
Rails: seed data from fixtures
Suppose you want to collect your seed data from your fixtures…
past the following in you db/seeds.rb – file:
Dir.glob('test/fixtures/*.yml').each do |file|
ActiveRecord::Fixtures.create_fixtures("#{Rails.root}/test/fixtures", File.basename(file).split(".").first)
end
Works in my new Rails 3.2.10 environment using ruby 1.9.3
automated patching against SQL Injection Vulnerability in Ruby on Rails (CVE-2012-5664)
Suppose you have a server with multiple rubies, rvms, gemsets, etc…
Manually finding and patching all affected activerecord-gems would be pretty cumbersome.
The following script does the job for you:
#!/usr/bin/env ruby
SEARCH_DIR = "/" # by default search the entire filesystem
ACTIVERECORD_GEM_VERSIONS = ['2.3','3.0','3.1','3.2']
PATCHES = {
'2.3' => 'https://bugzilla.redhat.com/attachment.cgi?id=672189',
'3.0' => 'https://bugzilla.redhat.com/attachment.cgi?id=672190',
'3.1' => 'https://bugzilla.redhat.com/attachment.cgi?id=672191',
'3.2' => 'https://bugzilla.redhat.com/attachment.cgi?id=672192',
}
#1. Find all activerecord 2.3.x, 3.0.x, 3.1.x, 3.2.x gems on this machine
gem_paths = {}
puts "Searching for activerecord gems inside #{SEARCH_DIR} ... "
ACTIVERECORD_GEM_VERSIONS.each do |version|
gem_paths[version] = `find #{SEARCH_DIR} -path '*/gems/activerecord*' -name 'activerecord-#{version}.*' -type d`.split("\n")
puts "Found the following activerecord gems for version #{version}:"
puts gem_paths[version]
end
#2. Download the 4 patches here
puts "Downloading the patches ... "
ACTIVERECORD_GEM_VERSIONS.each do |version|
`wget -O patch-#{version}.patch --no-check-certificate #{PATCHES[version]}`
end
puts " ... done"
#3. Apply the patches
ACTIVERECORD_GEM_VERSIONS.each do |version|
gem_paths[version].each do |gem|
puts "--------------------------\nApplying patch for gem #{gem}"
puts `cd '#{gem}'; patch -tN -p2 < '#{File.expand_path(File.dirname(__FILE__))+"/patch-"+version+".patch"}'`
end
end
This script searches for affected activerecord gems, downloads the required patches and applies them individually.
You might need to run it as root, and it could take a while searching your entire filesystem...
If you know where all your gems are located change the
SEARCH_DIR = "/yougemrepository"
Tested on linux, freebsd
bundle “reinstall”
After an OS upgrade you may find several gems broken, usually gems that rely OS dependent components(libraries, etc..)
If you’re using rvm/gemsets and bundler it’s pretty simple to reinstall all gems with their native extensions:
rvm gemset empty gemset-name
bundle install
If bundle install does not work – you may need to install bundler first:
gem i bundler
romanian translation for spree_i18n
Are you using spreecommerce?
We too 🙂
We just completed a romanian translation for spree, it’s available in the “official” spree_i18n-gem.
Take a look at our translation we just commited:
https://github.com/spree/spree_i18n/commit/9467f8fb00454bd56b7941ded443e937583689fa
To use it in your rails app, simply:
1. Add the following to your Gemfile
gem 'spree_i18n', :git => 'git://github.com/spree/spree_i18n.git'
2. Insert the following line in you config/application.rb
module Spreee
class Application < Rails::Application
...
config.i18n.default_locale = :ro
end
end
3. bundle install - și gata 🙂
SSL certs from STARTSSL – for nginx
Follow all necessary stept until Startssl gives you the ssl.key
openssl rsa -in ssl.key -out ssl.key
Follow further stepts until Startssl gives you the ssl.crt
Download StartSSL’s root CA and class 1 intermediate server CA certificates:
http://www.startssl.com/certs/ca.pem
http://www.startssl.com/certs/sub.class1.server.ca.pem
Now create a unified certificate:
cat ssl.crt sub.class1.server.ca.pem ca.pem > ssl-unified.crt
Upload the files ssl.key and ssl-unified.crt to the server
Do not forget to chmod 600 ssl.key
In your nginx ssl vhost include:
ssl on;
ssl_certificate /path/to/ssl-unified.crt;
ssl_certificate_key /path/to/ssl.key;
get size of subdirectories, INCLUDING the hidden ones
this command lists the “not hidden” directories and files:
du -sh *
this one lists only directories, including the hidden ones:
find -maxdepth 1 -type d -exec du -sh {} \;
tested on linux – bsd syntax may be different
scapati de spamul de la mailway
Un spammer extrem de insistent este mailway.
Cel putin in prezent se foloseste de serviciul de mailing al firmei Adnet Telecom: http://www.facebook.com/AdNetTelecom
In pofida mai multor raportari la abuse@adnettelecom.ro(indicatie a celor de la adnet chiar pe pagina de facebook) spamurile au continuat sa vina.
Deci, daca vrei sa scapi de mailway shit – cel putin pe moment – trebuie sa blochezi rangeul de IPuri al serviciului de mailing care il folosesc.
Din analiza ultimelor catorva zeci de spamuri primite acest range pare a fi: 37.43.130.1/24