Skip to content

Instantly share code, notes, and snippets.

View abelorian's full-sized avatar
🎯
Focusing

Abel O'Rian abelorian

🎯
Focusing
View GitHub Profile
@abelorian
abelorian / google_auth.rb
Created December 21, 2023 18:00
Login con Google. Obtener el usuario con OAuth2
# Instalar gem 'google-apis-core'
require 'google/api_client/client_secrets'
class GoogleAuth
# url definida en console.google
REDIRECT_TO = "http://localhost:4002"
@abelorian
abelorian / spreedly_conecta.json
Created May 6, 2022 21:25
Spreedly + Conekta purchase payload
{
"transaction": {
"payment_method_token": "TOKEN_CARD",
"amount": 60,
"currency_code": "MXN",
"retain_on_success": true,
"email": "abel@mail.com",
"gateway_specific_fields": {
"conekta": {
"customer": "John Doe",
@abelorian
abelorian / starken_api_rest.md
Last active March 11, 2021 22:32
Starken API Rest - WebService
@abelorian
abelorian / gist:96fcbb44503dc71eb83cbacc00400deb
Created July 16, 2020 17:13 — forked from brianr/gist:82ff15b17c839ff14748
Rollbar RQL: Search for occurrences in last 24 hours by url pattern
select *
from item_occurrence
where timestamp >= unix_timestamp() - 24 * 60 * 60
and request.url like '%mydomain.com%'
@abelorian
abelorian / mediastream.rb
Last active July 14, 2020 22:26
[RUBY] Mediastream API example + HTTP.rb Gem
class Mediastream
API_KEY = 'da...'
API_URL = 'https://platform.mediastre.am/api/live-stream'
PROFILE = {
"enabled": true,
"profile": "720p",
"video_bitrate": 2000000,
"audio_bitrate": 96000,
@abelorian
abelorian / Gemfile
Created June 25, 2020 15:11 — forked from dhh/Gemfile
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@abelorian
abelorian / gist:1f31f19726270ceb2f2bfacabf3abcdb
Created June 22, 2020 14:21 — forked from luckydev/gist:b2a6ebe793aeacf50ff15331fb3b519d
Increate max no of open files limit in Ubuntu 16.04/18.04 for Nginx
# maximum capability of system
user@ubuntu:~$ cat /proc/sys/fs/file-max
708444
# available limit
user@ubuntu:~$ ulimit -n
1024
# To increase the available limit to say 200000
user@ubuntu:~$ sudo vim /etc/sysctl.conf
@abelorian
abelorian / agora.rb
Last active September 22, 2023 11:35
Agora dynamic Key ruby RTC example. Gem agora_dynamic_key https://rubygems.org/gems/agora_dynamic_key
# In Gemfile: gem 'agora_dynamic_key', '~> 0.1.0'
require 'dynamic_key'
class Agora
EXPIRATION_TIME_IN_SECONDS = 3600*3
def generate_rtc_token channel_name = 'any_channel_name'
params = {
@abelorian
abelorian / server.md
Last active January 25, 2021 18:29
My ubuntu 18.04 server

Droplet

Create a new, start with the smallest droplet. Use Ubuntu 20.04, log in as root.

Server

sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install build-essential git-core curl zlib1g-dev libssl-dev libreadline-dev libmysqlclient-dev nginx -y
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install nodejs -y
@abelorian
abelorian / .zshrc
Created October 10, 2019 16:23
My zshrc
# Path to your oh-my-zsh installation.
export ZSH=/Users/abelorian/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"
# Uncomment the following line to use case-sensitive completion.