Skip to content

Instantly share code, notes, and snippets.

@hopsoft
hopsoft / db.rake
Last active May 6, 2024 14:00
Rails rake tasks for dump & restore of PostgreSQL databases
# lib/tasks/db.rake
namespace :db do
desc "Dumps the database to db/APP_NAME.dump"
task :dump => :environment do
cmd = nil
with_config do |app, host, db, user|
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump"
end
puts cmd
@jimevans
jimevans / Instructions
Last active March 17, 2021 23:29
Sample console application demonstrating unexpected firing of OnQuit event from IE11.
Prerequisites:
* A machine with Visual Studio 2013 installed
* A machine with IE11 installed
* The Protected Mode settings of all zones must be set to the same value
(on or off, it doesn't matter, as long as all zones are the same value)
* Enhanced Protected Mode should be disabled
Steps to reproduce:
1. Create a Visual Studio Solution with a C# Console Application project
consisting of the attached C# code, with references to MSHTML (Microsoft
@brunomlopes
brunomlopes / cgd.py
Last active September 22, 2019 17:43
Simple api to fetch accounts, balances and transactions from Caixa Geral de Depósitos's ( CGD ) API used by their Windows 8 application.
# gist: https://gist.github.com/4397792
# Usage:
# session = cgd.CgdSession(uid, password)
# session.login()
# session.load_latest_transactions(account_key)
# 'session.known_accounts' is now populated with the initial accounts taken from the login response,
# and the data for the 'account_key' account.
# session.load_latest_transactions(account_key) loads the latest transactions and balances for a given account.