Skip to content

Instantly share code, notes, and snippets.

View istana's full-sized avatar
🔭
life is good

Ivan Stana istana

🔭
life is good
View GitHub Profile
# 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\""
@istana
istana / Gemfile
Created February 24, 2015 22:20
minitest with DatabaseCleaner transactions, elasticsearch
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'
@istana
istana / ask_password.rb
Created November 30, 2013 19:45
Ask for password in ruby command line and do not show characters. And generate salt. Works in rake task.
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
#
# = 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
@istana
istana / devise.sk.yml
Created June 26, 2013 13:07
Slovak locale for Devise
# 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:
#!/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