Skip to content

Instantly share code, notes, and snippets.

View sponomarev's full-sized avatar
🔴
Offline

Sergey Ponomarev sponomarev

🔴
Offline
View GitHub Profile
@sponomarev
sponomarev / active_admin.css.scss
Last active December 24, 2015 23:39
active_admin bootstrap-like theme
$primary-color: #1B1B1B;
$text-color: #333;
$link-color: #08C;
$current-menu-item-background: $primary-color;
$hover-menu-item-background: $primary-color;
$secondary-gradient-start: #F7F7F9;
$secondary-gradient-stop: #F7F7F9;
@sponomarev
sponomarev / command.sh
Created November 9, 2013 10:43
Remove iTerm2 icon from Dock
# remove
/usr/libexec/PlistBuddy -c 'Add :LSUIElement bool true' /Applications/iTerm.app/Contents/Info.plist
# restore
/usr/libexec/PlistBuddy -c 'Delete :LSUIElement' /Applications/iTerm.app/Contents/Info.plist
require 'rubygems'
require 'eventmachine'
module ChatClient
def self.list
@list ||= []
end
def post_init
@name = "anonymous_#{rand(99999)}"
@sponomarev
sponomarev / Gemfile
Created January 29, 2014 11:45 — forked from gvarela/Gemfile
# A sample Gemfile
source "http://rubygems.org"
gem "redis"
gem 'eventmachine', :git => 'git://github.com/eventmachine/eventmachine.git'
gem "em-hiredis"
# gem "em-synchrony"
gem "em-websocket"
@sponomarev
sponomarev / mp3_to_ogg.sh
Last active August 29, 2015 14:00
mp3_to_ogg.sh
ffmpeg -i test.mp3 -vn -acodec libvorbis test.ogg
# oj gem
gem 'oj'
gem 'oj_mimic_json' # we need this for Rails 4.1.x
@sponomarev
sponomarev / policy.json
Last active April 19, 2017 00:46
AllowPublicRead S3 bucket policy
{
"Id":"AllowPublicRead",
"Statement":[
{
"Sid":"AllowPublicRead",
"Action":[
"s3:GetObject"
],
"Effect":"Allow",
"Resource":"arn:aws:s3:::your-bucket-name/*",
@sponomarev
sponomarev / sidekiq_stats_reset.rb
Last active June 30, 2017 20:28
Reset Sidekiq Stats
# Reset processed counter
Sidekiq.redis { |c| c.del('stat:processed') }
# Reset failed counter
Sidekiq.redis { |c| c.del('stat:failed') }
# Reset all redis database with counters, history and current queues
Sidekiq.redis { |c| c.flushdb }
@sponomarev
sponomarev / query_management.sql
Last active August 29, 2015 14:04
PG query management in simple query snippets
-- This queries were tested on PostgreSQL 9.3.4
-- Provides detailed information about servers current connections
SELECT datname as database,
pid,
user as username,
application_name as application,
client_addr as client_address,
query
FROM pg_stat_activity;
@sponomarev
sponomarev / show_biggest_tables.sql
Created August 4, 2014 09:25
PG biggest table in database
-- Show biggest tables in your database
SELECT nspname || '.' || relname AS "relation",
pg_size_pretty(pg_total_relation_size(C.oid)) AS "total_size"
FROM pg_class C
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
WHERE nspname NOT IN ('pg_catalog', 'information_schema')
AND C.relkind <> 'i'
AND nspname !~ '^pg_toast'
ORDER BY pg_total_relation_size(C.oid) DESC
LIMIT 20;