Instantly share code, notes, and snippets.

View gist:de7381f60ac0e398d9c5d9a3d05509aa
# the script goes through a whole file - apache log file and creates http request log records
# handles common and combined log format
# can handle duplicates and can handle different log styles
# Common Log Format (CLF) - common
# "%h %l %u %t \"%r\" %>s %b"
# Common Log Format with Virtual Host
# "%v %h %l %u %t \"%r\" %>s %b"
# NCSA extended/combined log format - combined
# "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""
View Gemfile
gem 'minitest'
gem 'minitest-rails'
group :development, :test do
# run when something change
gem 'guard'
gem 'guard-livereload'
# gem 'guard-rails_best_practices'
gem 'guard-minitest'
View ask_password.rb
salt = SecureRandom.base64
puts "Generated salt: #{salt} (only for information)"
passw = ''
puts 'Enter password: '
$stdin.noecho do
passw = $stdin.gets.strip
end
if passw.blank? || passw.length < 6
puts 'Password cannot be empty or shorter than 6 characters'
exit
View capistrano_database_yml.rb
#
# = Capistrano database.yml task
#
# Provides a couple of tasks for creating the database.yml
# configuration file dynamically when deploy:setup is run.
#
# Category:: Capistrano
# Package:: Database
# Author:: Simone Carletti <weppos@weppos.net>
# Copyright:: 2007-2010 The Authors
View devise.sk.yml
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
# Just to be clear:
# Author: Ivan Stana, http://github.com/istana
# License: MIT
# Base file: devise.en.yml
# Some elements taken from https://gist.github.com/MarosPixel/1295185 thx
# For versions 2.2, 3.0, maybe other
sk:
View slovak_localities_parser.rb
#!/usr/bin/env ruby
# -*- coding: UTF-8 -*-
# this program should be executed through
# rails runner
# /usr/bin/time -v ./script/rails runner ../add_locations.rb -y --obce /home/hero/html/OBCE.XLS --ulice /home/hero/html/ULICE.XLS
=begin
rails new psctest
rails g scaffold district name:string code:string
rails g scaffold county name:string code:integer district_id:integer shortcuts:text