Skip to content

Instantly share code, notes, and snippets.

View padi's full-sized avatar

Marc Ignacio padi

View GitHub Profile
@padi
padi / How to download streaming video.md
Created October 20, 2022 07:55 — forked from danfinlay/How to download streaming video.md
How to download a streaming video with Google Chrome

How to download streaming video

Streaming just means a download that they don't want you to keep. But Chrome's developer tools make it easy to access what's really going on under the hood.

Open Developer Tools

From the page where you want to download some things, go into your chrome menu to open the developer tools. You can either:

1.  (On a mac): Command-option-J
2. (On a PC): Control-alt-J
@padi
padi / in_relentless_pursuit_of_rest_notes.md
Created September 9, 2020 09:14 — forked from benoittgt/in_relentless_pursuit_of_rest_notes.md
"In Relentless Pursuit of Rest" from Derek Prior
@padi
padi / 00_Heroku-Release-Phase-Review-Apps-Rails_README.md
Created September 1, 2020 14:57 — forked from stevenharman/00_Heroku-Release-Phase-Review-Apps-Rails_README.md
Heroku Release Phase script for managing Rails DB migrations, and playing nice with Review Apps and postdeploy scripts

Heroku Release Phase + Review Apps + Rails

This is a simplified, but fairly thorough, set of scripts and configuration to enable Heroku Release Phase for Rails apps. Further, this particular set up plays nicely with Heroku Review Apps in that the release phase script will:

  1. Fail, loudly, if the DB does not yet exist.
  2. Load the DB schema if the current schema version (as determined by bin/rails db:version) is 0.
  3. Run DB migrations otherwise.

For a "normal" app that usually means it will run the DB migrations.

@padi
padi / fix_exfat_drive.md
Created August 27, 2020 01:53 — forked from scottopell/fix_exfat_drive.md
Fix corrupted exFAT disk macOS/OSX

exFAT support on macOS seems to have some bugs because my external drives with exFAT formatting will randomly get corrupted.

Disk Utility is unable to repair this at first, but the fix is this:

  1. Use diskutil list to find the right drive id.
  2. You want the id under the IDENTIFIER column, it should look like disk1s1
  3. Run sudo fsck_exfat -d <id from above>. eg sudo fsck_exfat -d disk1s3
  4. -d is debug so you'll see all your files output as they're processed.
  5. Answer YES if it gives you the prompt Main boot region needs to be updated. Yes/No?
@padi
padi / Gemfile
Created July 9, 2020 02:46 — forked from dhh/Gemfile
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
namespace :gold do
desc "DATABASE will be used to generate the new gold master database"
task :update_db do
db_name = ENV.fetch('DATABASE') { Rails.configuration.database_configuration[Rails.env]["database"] }
destination = Rails.root.join('test/files/gold_master.sql')
puts "Executing command..."
sh "pg_dump #{db_name} --data-only --attribute-inserts --column-inserts --no-tablespaces --no-privileges --no-security-labels --disable-triggers > #{destination}"
puts <<~MSG
Done!
@padi
padi / db_fixtures_export.rake
Last active April 8, 2020 10:50 — forked from existentialmutt/db_fixtures_export.rake
Generate fixtures from db. Readable by rake db:fixtures:load
# https://gist.github.com/kuboon/55d4d8e862362d30456e7aa7cd6c9cf5
namespace 'db:fixtures' do
desc "generate fixtures from the current database"
task :export => :environment do
Rails.application.eager_load!
models = defined?(ApplicationRecord) ? ApplicationRecord.descendants : ActiveRecord::Base.descendants
models.each do |model|
puts "exporting: #{model}"
@padi
padi / db_fixtures_export.rake
Created April 8, 2020 02:51 — forked from kuboon/db_fixtures_export.rake
Generate fixtures from db. Readable by rake db:fixtures:load
# lib/tasks/db_fixtures_export.rake
namespace 'db:fixtures' do
desc "generate fixtures from the current database"
task :export => :environment do
Rails.application.eager_load!
models = defined?(AppicationRecord) ? ApplicationRecord.decendants : ActiveRecord::Base.descendants
models.each do |model|
puts "exporting: #{model}"
@padi
padi / bench.sh
Created March 26, 2020 07:00 — forked from james2doyle/bench.sh
A website benchmarking script using Apache ab. This script hits a target with requests and then generates a small report for each case.
#!/usr/bin/env bash
# idea from https://www.devside.net/wamp-server/load-testing-apache-with-ab-apache-bench
# if you are testing a base url, you need a trailing slash
SITE="http://example.com/"
OUTFILE="output.txt"
DIVIDER="\n====================================================================\n"
# if the file doesnt exist, make it
@padi
padi / original.db_fixtures_dump.rake
Last active April 8, 2020 02:46 — forked from ecleel/db_fixtures_dump.rake
Rails 5: Dump Rails db to fixtures (Fixed spacing in the latter)
# Original from http://snippets.dzone.com/posts/show/4468 by MichaelBoutros
#
# Optimized version which uses to_yaml for content creation and checks
# that models are ActiveRecord::Base models before trying to fetch
# them from database.
namespace :db do
namespace :fixtures do
desc 'Dumps all models into fixtures.'
task :dump => :environment do
models = Dir.glob(Rails.root + 'app/models/**.rb').map do |s|