Skip to content

Instantly share code, notes, and snippets.

View aks's full-sized avatar
💭
Working

Alan Stebbens aks

💭
Working
View GitHub Profile
@aks
aks / db.rake
Last active December 11, 2015 03:03 — forked from hopsoft/db.rake
Rails rake tasks for dump & restore of PostgreSQL databases
# lib/tasks/db.rake
namespace :db do
desc "Dumps the database to backups"
task :dump => :environment do
dump_fmt = 'c' # or 'p', 't', 'd'
dump_sfx = suffix_for_format dump_fmt
backup_dir = backup_directory true
cmd = nil
@aks
aks / Main.elm
Last active April 28, 2017 16:35 — forked from anonymous/Main.elm
SVG Clock with hands
-- Read more about this program in the official Elm guide:
-- https://guide.elm-lang.org/architecture/effects/time.html
module Main exposing (..)
import Html exposing (Html, div, br)
import String exposing (padLeft, join)
import Date
import Color exposing (Color)
@aks
aks / postgres_queries_and_commands.sql
Last active April 23, 2018 16:01 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
-- SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
-- FROM pg_stat_activity
-- WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
-- ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@aks
aks / clear-sidekiq-jobs.sh
Created August 9, 2018 19:39 — forked from wbotelhos/clear-sidekiq-jobs.sh
Clear Sidekiq Jobs
# 1. Clear retry set
Sidekiq::RetrySet.new.clear
# 2. Clear scheduled jobs
Sidekiq::ScheduledSet.new.clear
# 3. Clear 'Processed' and 'Failed' jobs