Skip to content

Instantly share code, notes, and snippets.

View parallel588's full-sized avatar

Maksim Pechnikov parallel588

  • WELLNUTS
  • Tampere
View GitHub Profile
@parallel588
parallel588 / check task
Last active August 29, 2015 14:03
racksapce export image
curl -X GET \
-H "X-Auth-Token: $OS_AUTH_TOKEN" \
"https://lon.images.api.rackspacecloud.com/v2/tasks/$TASK_IDb" | python -m json.tool
find . -name "*.haml" | while read i; do haml -f xhtml -q "$i" "${i%.*}.html"; done
# Script to delete all but a specified list of tags
# from a git repo, both locally and remotely
# Run like `mode=test ruby git_tag_cleanup` to test;
# use 'execute' mode to actually delete the tags
mode = ENV['mode'] || 'test'
tags_to_keep = %w[v2.0.0 v2.0.1]
tags_to_delete = `git tag`.split("\n") - tags_to_keep
@parallel588
parallel588 / gist:8780554
Created February 3, 2014 08:34
grep search & replace
✗ grep will_paginate * -R | xargs sed -i 's/will_paginate/paginate/g'
%h3 Update status
= form_for(@shipment, url: update_shipment_admin_purchase_url(@purchase, shipment_id: @shipment.id), html: {method: :put, class: 'neat'}) do |f|
= f.select :status, options_for_select(shipment_status(@shipment)), {include_blank: '-- Choose status --'}, { 'ng-model' => "ShipmentStatus", 'ng-change' => 'ShipmentStatusChange()' }
%div{ 'ng-include' => "statusFieldset" }
%script#shippedFieldset{type: "text/ng-template"}
%fieldset
= f.label :tracking_code, "Tracking Code"
= f.text_field :tracking_code
= f.label :tracking_website, "Tracking Website"
require 'yaml'
desc 'Generates database.yml, optional arguments: [adapter, user, password]'
task :dbconfig => 'database.yml'
file 'database.yml', [:adapter, :username, :password] do |t, args|
Dir.chdir('config')
args.with_defaults(:project_path => Dir.pwd)
DBConfigGenerator.new(t, args).generate
end
@parallel588
parallel588 / Gemfile
Created November 28, 2013 09:29 — forked from pcreux/Gemfile
group :production do
gem 'unicorn'
# Enable gzip compression on heroku, but don't compress images.
gem 'heroku-deflater'
# Heroku injects it if it's not in there already
gem 'rails_12factor'
end
source 'https://rubygems.org'
gem 'activerecord', '4.0.0.rc1'
#!/usr/bin/env ruby -w
require 'rubygems'
require 'fog'
require 'pp'
AWS_ACCESS_KEY = ENV['AWS_ACCESS_KEY_ID']
AWS_SECRET_KEY = ENV['AWS_SECRET_ACCESS_KEY']
def get_cf_connection()
@parallel588
parallel588 / gist:7488073
Created November 15, 2013 17:17
sidekiq.ru
#!/usr/bin/env ruby
require "sidekiq"
Sidekiq.configure_client do |config|
config.redis = { size: 1 }
end
require "sidekiq/web"
Sidekiq::Web.use Rack::Auth::Basic do |username, password|