Skip to content

Instantly share code, notes, and snippets.

@unnitallman
unnitallman / gist:944011
Created April 27, 2011 10:11
sqlite with activerecord outside rails
require 'active_record'
ActiveRecord::Base.logger = Logger.new(STDERR)
ActiveRecord::Base.colorize_logging = false
ActiveRecord::Base.establish_connection(
:adapter => "sqlite3",
:dbfile => ":memory:"
)
@unnitallman
unnitallman / neetoauth-checklist.md
Last active October 10, 2021 18:57 — forked from ghousemohamed/neetoauth-checklist.md
neetoAuth checklist for a neeto client application
  • Integrate neeto_sso gem
  • Drop organization_neeto_applications table from client application and remove associated test cases and references throughout the application
  • Verify organization enabling/disabling API is working for client application
  • Verify that favicon when updated in neetoAuth is being updated and in use in the client application as well
  • Verify if the user name and profile image urls when updated in neetoAuth is being updated and in use in the client application as well
  • Verify if User activation/deactivation is being handled properly, i.e. A concern which blocks access
  • Verify User Invitation API
  • Make sure profile settings page and organization settings page open correctly. (neetoForm has done this correctly)
sudo -u postgres psql
postgres=# create database mydb;
postgres=# create user myuser with encrypted password 'mypass';
postgres=# grant all privileges on database mydb to myuser;
@unnitallman
unnitallman / s3.markdown
Created June 26, 2018 05:15 — forked from greenantdotcom/s3.markdown
Setting public read-only ACL for uploaded files

Alternatively, in the Amazon interface, you can select a directory or file, and click on the action "Mark as public"

@unnitallman
unnitallman / assets.rake
Created February 8, 2017 06:28 — forked from Geesu/assets.rake
Disable asset precompilation on heroku
Rake::Task["assets:precompile"].clear
namespace :assets do
task 'precompile' do
puts "Not pre-compiling assets..."
end
end
@unnitallman
unnitallman / gist:8277938
Created January 6, 2014 03:49
To speed up github actions, by maintaining an ssh connection. Add the lines below to ~/.ssh/config
ControlMaster auto
ControlPath /tmp/%r@%h:%p
ControlPersist yes
@unnitallman
unnitallman / gist:7448221
Created November 13, 2013 12:23
Convert twitter username to user id
Add the gem "twitter" to Gemfile.
client = Twitter::Client.new(
:consumer_key => "key",
:consumer_secret => "secret",
)
[8] pry(main) client.users("unnitallman")[0].id
=> 11976602
@unnitallman
unnitallman / s3_url_obfuscation
Created November 10, 2013 14:24
Moving S3 objects from one bucket to another, along with URL obfuscation
secret = "a_big_secret"
#expects S3 credentials in congif/aws.yml
s3 = AWS::S3.new
i = 0
source = 'source_bucket_name'
target = 'target_bucket_name'
# see http://stackoverflow.com/questions/5880962/how-to-destroy-jobs-enqueued-by-resque-workers - old version
# see https://github.com/defunkt/resque/issues/49
# see http://redis.io/commands - new commands
namespace :resque do
desc "Clear pending tasks"
task :clear => :environment do
queues = Resque.queues
queues.each do |queue_name|
puts "Clearing #{queue_name}..."