Skip to content

Instantly share code, notes, and snippets.

View jcuervo's full-sized avatar
💭
I may be slow to respond.

Chard Gonzales jcuervo

💭
I may be slow to respond.
View GitHub Profile
@jcuervo
jcuervo / twilio_messaging_service.rb
Created August 23, 2023 23:55
Send Message via net/http for Twilio Messaging Service
require 'uri'
require 'net/http'
class TwilioMessage
def initialize(options = {})
@account_sid = ENV.fetch('TWILIO_ACCOUNT_SID')
@account_token = ENV.fetch('TWILIO_AUTH_TOKEN')
@message_service_sid = ENV.fetch('TWILIO_MSID')
import { Injectable } from '@angular/core';
@Injectable()
export class AppSettingsProvider {
endPoint: string;
baseUrl: string;
mode: string;
constructor() {
@jcuervo
jcuervo / Autobackup PostGres to AWS
Last active May 21, 2016 05:51
Run an auto-backup script from Ubuntu (running Ruby on Rails app) on PostGres database.
Attempt to run an auto-backup script from DigitalOcean Ubuntu Droplet (running Ruby on Rails app) on PostGres database.
1. Setup s3cmd
S3cmd will upload the backup files generated.
The `sync` command will be executed after the autopostgresqlbackup script finished it's job (added on the POSTBACKUP command).
Follow the steps enumerated in https://levels.io/backup-linode-digital-ocean-vps-amazon-s3/ until the recusive part:
s3cmd sync --recursive --preserve /your-folder-name-to-backup s3://nameofyours3bucket
2. Setup AutoPostGresqlBackup
Follow the instructions in the `Installing and configuring autopostgresqlbackup in CentOS 7` from:
def attempt_login
authorized_user = User.authenticate(params[:username], params[:hashed_password])
unless authorized_user.eql?(false)
session[:user_id] = authorized_user.id
session[:username] = authorized_user.username
case authorized_user.account_type
when "admin"
redirect_to :action => "index"
when "it"
redirect_to :action => "it"