Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Abel O'Rian abelorian

🎯
Focusing
View GitHub Profile
@abelorian
abelorian / gist:96fcbb44503dc71eb83cbacc00400deb
Created Jul 16, 2020 — forked from brianr/gist:82ff15b17c839ff14748
Rollbar RQL: Search for occurrences in last 24 hours by url pattern
View gist:96fcbb44503dc71eb83cbacc00400deb
select *
from item_occurrence
where timestamp >= unix_timestamp() - 24 * 60 * 60
and request.url like '%mydomain.com%'
@abelorian
abelorian / mediastream.rb
Last active Jul 14, 2020
[RUBY] Mediastream API example + HTTP.rb Gem
View mediastream.rb
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 Jun 25, 2020 — forked from dhh/Gemfile
HEY's Gemfile
View 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 Jun 22, 2020 — forked from luckydev/gist:b2a6ebe793aeacf50ff15331fb3b519d
Increate max no of open files limit in Ubuntu 16.04/18.04 for Nginx
View gist:1f31f19726270ceb2f2bfacabf3abcdb
# 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 Jun 10, 2020
Agora dynamic Key ruby RTC example. Gem agora_dynamic_key https://rubygems.org/gems/agora_dynamic_key
View agora.rb
# 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
Created Jan 13, 2020
My ubuntu 18.04 server
View server.md

DigitalOcean Rails/Ubuntu/NGINX (16.04) Setup

  1. Setup
  2. Swapfile
  3. NGINX
  4. Rbenv
  5. Rails
  6. Let's Encrypt
  7. Nginx Server finalization 11 Puma upstart Script (systemd)
View .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.
@abelorian
abelorian / upload.html.erb
Last active Oct 30, 2018
Preview in upload file with javascript and ruby on rails
View upload.html.erb
<div class="control-group">
<%= form.label :plan_image %>
<div class="controls">
<div id="plan_image_preview_block" class="imageUpload imageUpload-16_9" style="<%= 'display: none;'.html_safe if @plan.try(:plan_image).try(:url).nil? %>">
<div class="imageUpload-media" id="plan_image_preview" style="background-image: url(<%= @plan.try(:plan_image).try(:url) || '' %>);"></div>
</div>
<div class="input-file-wrapper">
<a class="btn btn--s btn--secondary">
<% if @plan.plan_image.present? && @plan.plan_image.file.exists? %>
<i class="icon icon-16 flaticon stroke photo-1"></i> Change image
@abelorian
abelorian / bitcoin.conf
Last active Sep 27, 2018
Bitcoin 16.3 configuration for low memory RAM servers (i.e 512 MB)
View bitcoin.conf
dbcache=30
maxmempool=10
maxconnections=3
disablewallet=1
@abelorian
abelorian / generic_worker.rb
Last active Aug 8, 2018
Generic Worker Rails
View generic_worker.rb
# To do: add validations
class GenericWorker < ApplicationWorker
def perform(options)
klass = options["klass"].constantize
if options["id"].present?
if options[:params].present?
klass.find(options["id"]).send options["method_name"], options["params"]
else
klass.find(options["id"]).send options["method_name"]
You can’t perform that action at this time.