Skip to content

Instantly share code, notes, and snippets.

View cesc1989's full-sized avatar
🐻
¿Cuál es la diferencia entre la participación y el compromiso?

Francisco Quintero cesc1989

🐻
¿Cuál es la diferencia entre la participación y el compromiso?
View GitHub Profile
@cesc1989
cesc1989 / create_db_from_csv.rb
Created November 8, 2024 23:24
Crea una base de datos SQLite a partir de un archivo CSV.
require "csv"
require "sqlite3"
if ARGV.length < 3
puts "Uso: ruby create_db_from_csv.rb ruta/al/archivo.csv debugging.dashboard.db nombre_tabla"
exit
end
csv_file = ARGV[0]
@cesc1989
cesc1989 / action_mailer_and_sidekiq.md
Last active May 19, 2021 02:03 — forked from maxivak/00.md
How to send emails with ActionMailer and Sidekiq

Sending emails with ActionMailer and Sidekiq

Send email asynchroniously using Sidekiq.

ActionMailer

Create mailer class:

# app/mailers/user_mailer.rb
@cesc1989
cesc1989 / hello_macro.rb
Last active August 18, 2020 21:46 — forked from crescentrose/hello_macro.rb
Cómo se escriben las macros en Ruby
module SaysHi
def self.included(base)
base.extend ClassMethods
end
module ClassMethods
def hi_to
@hi_to ||= ""
end
@cesc1989
cesc1989 / create-room.js
Created April 21, 2020 15:17
Ember Octane + Twilio Video
import Component from '@glimmer/component';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';
import { inject as service } from '@ember/service';
import * as Video from 'twilio-video/dist/twilio-video';
import { attachTracks } from "../utils/intrati-twilio";
export default class CreateRoomComponent extends Component {
@cesc1989
cesc1989 / 001_position_args.sh
Created October 11, 2017 17:58
Different ways for declaring a function's arguments in Bash scripts
#!/bin/bash -xe
function byPosition () {
echo "Variable in position 1: $1"
echo "Variable in position 2: $2"
}
byPosition hola mundo
@cesc1989
cesc1989 / wp-config.php
Created October 11, 2017 17:30
Set WordPress site URL in the config file instead of the database
<?php
// WordPress stores the site URL in the database by default (which I have never
// understood), and it's a pain to have to type out the UPDATE SQL or search in
// phpMyAdmin to change it. This is a simple way to put the URL into
// wp-config.php instead.
// Note that you will still need to update any URLs that appear in the content,
// especially when you copy a database from a development site to production:
// https://gist.github.com/davejamesmiller/a8733a3fbb17e0ff0fb5
@cesc1989
cesc1989 / deploy-aws-codedeploy.sh
Last active July 28, 2020 19:09
Todos mis scripts personales que uso o dejé de usar.
#!/bin/bash -xe
#
# Deploy latest revision without going to the AWS web console (used for failed deployments)
#
# jq needs to be installed
# https://stedolan.github.io/jq/
aws --region us-west-2 \
deploy list-application-revisions \
--application-name staging \
@cesc1989
cesc1989 / sns_to_slack.js
Created September 22, 2017 20:10
Send Code Deploy deployment status to Slack via SNS using a Lambda function
var https = require('https');
var util = require('util');
exports.handler = function(event, context){
console.log(JSON.stringify(event, null, 2));
console.log('From SNS:', event.Records[0].Sns.Message);
var postData = {
"channel": "#server-deploys",
"username": "AWS SNS via Lambda",
@cesc1989
cesc1989 / ubuntu_unattended_upgrades_gmail.md
Last active March 8, 2017 19:33 — forked from roydq/ubuntu_unattended_upgrades_gmail.markdown
Unattended upgrades on Ubuntu 14.04 with email notifications

Getting Started

Install unattended-upgrades:

$ sudo apt-get update && sudo apt-get install -y unattended-upgrades 

Frequency Configuration

@cesc1989
cesc1989 / multi-git.md
Last active March 20, 2019 22:04 — forked from rosswd/multi-git-win.md
Setting up a Github and Bitbucket account on the same computer.

Setting up a separate github and bitbucket account on the same computer

Github will be the main account and bitbucket the secondary.

Create SSH Keys

ssh-keygen -t rsa -C "github email"

Save keys to:

~/.ssh/id_rsa