Skip to content

Instantly share code, notes, and snippets.

Avatar

Corey Daley coreydaley

View GitHub Profile
@coreydaley
coreydaley / twilio.rb
Created Jan 30, 2021
Send Twilio SMS using HTTParty gem
View twilio.rb
response = HTTParty.post("https://api.twilio.com/2010-04-01/Accounts/#{twilio_sid}/Messages.json",
basic_auth: {username: "#{twilio_sid}", password: "#{twilio_token}"},
headers: {'Accept' => 'application/json'},
body: {
Body: "#{body}",
From: "#{twilio_number}",
To: "#{recipient_number}""
}
)
View .gitignore_global
$ cat ~/.gitignore_global
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
@coreydaley
coreydaley / drain-bucket.go
Created Aug 2, 2019
Incomplete implementation of concurrently batch deleting s3 objects to drain a bucket before deletion
View drain-bucket.go
// emptyBucket deletes all objects from the specified s3 bucket
// so that the bucket can be deleted
func (d *driver) emptyBucket(svc *s3.S3) error {
wg := sync.WaitGroup{}
if err := svc.ListObjectsPages(&s3.ListObjectsInput{
Bucket: aws.String(d.Config.Bucket),
}, func(page *s3.ListObjectsOutput, lastPage bool) bool {
wg.Add(1)
go func(svc *s3.S3, objects []*s3.Object) {
defer wg.Done()