Skip to content

Instantly share code, notes, and snippets.

View swanandp's full-sized avatar
🖥️

Swanand Pagnis swanandp

🖥️
View GitHub Profile
@swanandp
swanandp / itunesicon.rb
Created December 3, 2019 08:08 — forked from ttscoff/itunesicon.rb
Retrieve a 512 x 512px icon for an iOS app
#!/usr/bin/ruby
# encoding: utf-8
#
# Updated 2017-10-25:
# - Defaults to large size (512)
# - If ImageMagick is installed:
# - rounds the corners (copped from @bradjasper, https://github.com/bradjasper/Download-iTunes-Icon/blob/master/itunesicon.rb)
# - replace original with rounded version, converting to png if necessary
#
# Retrieve an iOS app icon at the highest available resolution
@swanandp
swanandp / postgres_queries_and_commands.sql
Created December 7, 2017 07:15 — 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%'
2012-03-29T10:25:10+00:00 app[app.1]: #bangalore-ruby <keyword> tweet - Returns a link to a tweet about <keyword>
2012-03-29T10:25:10+00:00 app[app.1]: <travis me> sferik/rails_admin - Returns the build status of https://github.com/sferik/rails_admin
2012-03-29T10:25:10+00:00 app[app.1]: <user> is a badass guitarist - assign a role to a user
2012-03-29T10:25:10+00:00 app[app.1]: <user> is not a badass guitarist - remove a role from a user
2012-03-29T10:25:10+00:00 app[app.1]: Find the build status of an open-source project on Travis
2012-03-29T10:25:10+00:00 app[app.1]: animate me <query> - The same thing as `image me`, except adds a few
2012-03-29T10:25:10+00:00 app[app.1]: convert me <expression> to <units> - Convert expression to given units.
2012-03-29T10:25:10+00:00 app[app.1]: help <query> - Displays all help commands that match <query>.
2012-03-29T10:25:1
0+00:00 app[app.1]: help - Displays all of the help commands that bangalorehubot knows about.
@swanandp
swanandp / authlogic_config_example.rb
Created August 4, 2011 13:17
Shows off a few samples for acts_as_authentic configuration
class User < ActiveRecord::Base
# gradual engagement is needed, to allow admin creation of users
# users should create authorization data only when they need to
# access some system feature that requires authentication
# So ... our gradual engagement scheme for authlogic:
# 1. admin creates user, setting only name and phone number (required)
# admin may set email address (optional)
# 2. user is sent email invitation with link to activate their account
# admin can re-send email at user's request
# 3. user sets login and password/password_confirmation using activation form