Skip to content

Instantly share code, notes, and snippets.

View scottburton11's full-sized avatar

Scott Burton scottburton11

View GitHub Profile
@scottburton11
scottburton11 / recover.rb
Last active January 11, 2023 23:22
Recover deleted S3 files from a versioned bucket
require 'json'
def recover_bucket(bucket)
list = `aws s3api list-object-versions --bucket #{bucket} --output json --query 'DeleteMarkers[?IsLatest==\`true\`].[Key, VersionId]'`
pairs = JSON.parse(list)
pairs.each do |(key, versionId)|
STDOUT.puts `aws s3api delete-object --bucket #{bucket} --key #{key} --version-id #{versionId}}`
end
end
[
{"Year":"2018","Make":"Cadillac","Model":"CT6","Styling":"6","Acceleration":"4","Handling":"5","Fun Factor":"4","Cool Factor":"4","Weekend Score Total":"23","Features":"9","Comfort":"8","Quality":"8","Practicality":"5","Value":"7","Daily Score Total":"37","Total Score":"60","Video Link":"23:47","Filmed At City":"Tustin","Filmed At Country":"California","Vehicle Country":"USA","id":117},
{"Year":"2018","Make":"Bugatti","Model":"Chiron","Styling":"9","Acceleration":"10","Handling":"9","Fun Factor":"10","Cool Factor":"10","Weekend Score Total":"48","Features":"6","Comfort":"5","Quality":"7","Practicality":"1","Value":"6","Daily Score Total":"25","Total Score":"73","Video Link":"35:06","Filmed At City":"Toronto","Filmed At Country":"Ontario","Vehicle Country":"France","id":1},
{"Year":"2019","Make":"BMW","Model":"i8 Roadster","Styling":"7","Acceleration":"7","Handling":"7","Fun Factor":"6","Cool Factor":"7","Weekend Score Total":"34","Features":"7","Comfort":"6","Quality":"7","Practicality":"2","Value":"6
@scottburton11
scottburton11 / gist:10221751
Created April 9, 2014 02:50
Facebook RSVP using the JS SDK
<html>
<body>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '721489701236648',
status : true,
xfbml : true
});
@scottburton11
scottburton11 / Gemfile
Last active December 14, 2015 04:28 — forked from tsnow/README.md
source :rubygems
gem 'yajl-ruby'
curl -X GET http://localhost:9200/gig_tracks/track/_search -d '
{ filter:
{ has_child:
{ type: gig_track,
filter:
{ geo_distance:
{ location :
{lat: 33, lng: -118},
distance: 100mi
}
u = User.new(:name => "Borris Yeltzin", :date_of_birth => Date.today - 20.years, :ssn => "1234")
=> #<User id: nil, email: nil, name: "Borris Yeltzin", crypted_password: nil, salt: nil, claimable: true, date_of_birth: "1992-10-29", ssn: "1234", created_at: nil, updated_at: nil>
[4] pry(main)> u.save
(0.2ms) BEGIN
SQL (2.8ms) INSERT INTO "users" ("claimable", "created_at", "crypted_password", "date_of_birth", "email", "name", "salt", "ssn", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9) RETURNING "id" [["claimable", true], ["created_at", Mon, 29 Oct 2012 16:15:46 UTC +00:00], ["crypted_password", nil], ["date_of_birth", Thu, 29 Oct 1992], ["email", nil], ["name", "Borris Yeltzin"], ["salt", nil], ["ssn", "1234"], ["updated_at", Mon, 29 Oct 2012 16:15:46 UTC +00:00]]
(0.3ms) COMMIT
=> true
[5] pry(main)> u.update_attributes(:email => "borris.yeltzin@example.com", :password => "f00bar", :password_confirmation => "f00bar")
(0.2ms) BEGIN
(0.3ms) ROLLBACK
<html>
<head>
<script src="../javascripts/d3.v2.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
var g = d3.select("body").data([1,2,3,4]);
g.enter().append("p");
</script>
</head>
<body>
</body>
@scottburton11
scottburton11 / gist:3239347
Created August 2, 2012 18:21
Warden FailureApp for Devise token_authentication
class MyApp::FailureApp < Devise::FailureApp
def respond
if api_token_failure?
invalid_token
elsif api_login_failure?
invalid_credentials
else
super
end
@scottburton11
scottburton11 / gist:3222152
Created August 1, 2012 00:58
Audio Compression for Voiceover

About compression

Audio compression is used to reduce the dynamic range of a recording. Dynamic range is the difference between the loudest and softest parts of an audio signal. It was originally used to guard against defects when cutting wax and vinyl phonograph records, but generally became useful as a way of increasing the loudness of an audio recording without achieving distortion.

The goal of most compression applications is to increase the amplitude of the softest parts of a recording, without increasing the amplitude of the loudest parts.

Compressor anatomy

Compressors generally all have the same conceptual parts. However, not all compressors present variable controls for all parts to the user. If you don't see all of your compressor's controls here, there's a chance it either has a fixed value (and no control), or is named something else:

@scottburton11
scottburton11 / gist:2013555
Created March 10, 2012 22:12
mongo slave replication failure
Sat Mar 10 22:11:06 [replslave] local.me Assertion failure fileNo != -1 db/rec.h 126
0x534a81 0x54163f 0x720b18 0x7290c1 0x72f52f 0x61f447 0x622b6c 0x6f8177 0x651c99 0x6530a6 0x65e1a0 0x65e6a8 0x65ee11 0x65f59a 0x83a4b0 0x7f9977e74971 0x7f997743192d
/opt/mongodb-1.6.5/bin/mongod(_ZN5mongo12sayDbContextEPKc+0xb1) [0x534a81]
/opt/mongodb-1.6.5/bin/mongod(_ZN5mongo8assertedEPKcS1_j+0x10f) [0x54163f]
/opt/mongodb-1.6.5/bin/mongod() [0x720b18]
/opt/mongodb-1.6.5/bin/mongod(_ZN5mongo11DataFileMgr6insertEPKcPKvibRKNS_11BSONElementEb+0x1051) [0x7290c1]
/opt/mongodb-1.6.5/bin/mongod(_ZN5mongo11DataFileMgr16insertWithObjModEPKcRNS_7BSONObjEb+0x5f) [0x72f52f]
/opt/mongodb-1.6.5/bin/mongod(_ZN5mongo14_updateObjectsEbPKcRKNS_7BSONObjES2_bbbRNS_7OpDebugEPNS_11RemoveSaverE+0xb77) [0x61f447]
/opt/mongodb-1.6.5/bin/mongod(_ZN5mongo13updateObjectsEPKcRKNS_7BSONObjES2_bbbRNS_7OpDebugE+0x11c) [0x622b6c]
/opt/mongodb-1.6.5/bin/mongod(_ZN5mongo7Helpers12putSingletonEPKcNS_7BSONObjE+0x107) [0x6f8177]