Skip to content

Instantly share code, notes, and snippets.

View albertico's full-sized avatar

Alberto Colón Viera albertico

  • Washington, DC / Puerto Rico
View GitHub Profile
@albertico
albertico / send_smtp_ses.rb
Last active November 6, 2018 06:46
SMTP Examples for Amazon SES and WorkMail
#!/usr/bin/env ruby
require 'mail'
Mail.defaults do
delivery_method :smtp, { :address => "email-smtp.us-east-1.amazonaws.com",
:port => 587,
:user_name => "YOUR_IAM_SMTP_USER_FOR_SES",
:password => "YOUR_VERY_LONG_PASSWORD",
:authentication => 'plain',
@albertico
albertico / sqlite-cli-quickstart.md
Created August 24, 2015 15:59
SQLite CLI Quickstart

SQLite CLI Quickstart

Commands

Command Description
.backup ?DB? FILE Backup DB (default "main") to FILE
.bail ON | OFF Stop after hitting an error. Default OFF
.databases List names and files of attached databases
.dump ?TABLE? Dump the database in an SQL text format. If TABLE specified, only dump tables matching LIKE pattern TABLE.
@albertico
albertico / sequel-tinytds-mssql-example.md
Last active October 18, 2022 16:04
A sample script for connecting to MS SQL Server database using Sequel ORM with the TinyTDS adapter.

Ruby Sequel TinyTDS MS SQL Example

A sample script for connecting to MS SQL Server database using Sequel ORM with the TinyTDS (FreeTDS) adapter.

#!/usr/bin/env ruby

require 'sequel'
require 'tiny_tds'
@albertico
albertico / keybase.md
Created February 9, 2015 02:44
Keybase proof

Keybase proof

I hereby claim:

  • I am albertico on github.
  • I am albertico (https://keybase.io/albertico) on keybase.
  • I have a public key whose fingerprint is 42E4 0469 E7C9 BE31 4B3D AFDC 7329 438E B0AD E560

To claim this, I am signing this object:

@albertico
albertico / str-reverse-gsub-vowels-ascii-dec-rb.md
Last active August 29, 2015 14:10
How to reverse a string and replace the vowels with their corresponding ASCII decimal value (using Ruby)

How to reverse a string and replace the vowels with their corresponding ASCII decimal value (using Ruby)

For the purpose of this example, the Interactive Ruby Shell (IRB) will be used.

Start the IRB by executing the irb command from your terminal:

% > irb
@albertico
albertico / ms-win-net-use.md
Last active August 15, 2023 20:30
MS Windows: Mapping a Network Drive (NET USE command)

MS Windows: Mapping a Network Drive (NET USE command)

Basic Mapping

net use M: \\share\folder

Mapping with Authentication

@albertico
albertico / goliath_cors.rb
Created March 5, 2014 02:04
Goliath server with CORS middleware
#!/usr/bin/env ruby
require 'goliath'
class CORS
include Goliath::Rack::AsyncMiddleware
def post_process(env, status, headers, body)
headers['Access-Control-Allow-Origin'] = '*'
[status, headers, body]
@albertico
albertico / mandrill-mail-example.rb
Last active August 29, 2015 13:56
Mandrill Example (Ruby)
#!/usr/bin/env ruby
require 'mail'
Mail.defaults do
delivery_method :smtp, { :address => "smtp.mandrillapp.com",
:port => 587,
:user_name => "YOUR_MANDRILL_USERNAME",
:password => "YOUR_API_KEY",
:authentication => 'plain',