Skip to content

Instantly share code, notes, and snippets.

View albertogg's full-sized avatar

Alberto Grespan albertogg

View GitHub Profile
@albertogg
albertogg / firewall.sh
Last active April 16, 2023 05:17
EdgeRouter Lite configuration
# This configuration is based on the Wizard config and also the these ones:
# https://blog.dlasley.net/2013/06/initial-configuration-ubiquiti-edgerouter-lite/
# http://lg.io/2015/01/11/the-ubiquiti-edgerouter-configuring-this-extremely-lowcost-enterprisegrade-router-for-home-use.html
#
# Create simple firewall rules for Inbound wan to lan and local router
edit firewall
set all-ping enable
set broadcast-ping disable
set ipv6-receive-redirects disable
set ipv6-src-route disable
@albertogg
albertogg / redcarpet.rb
Last active September 24, 2021 12:17
Rails markdown parser using Redcarpet. It also parses erb within the markdown template.
# gem install redcarpet
# config/initializers/redcarpet.rb
# {viewname}.html.md
module ActionView
class Template
module Handlers
class Markdown
class_attribute :default_format
self.default_format = Mime::HTML
@albertogg
albertogg / development.rb
Last active July 19, 2019 00:16
unicorn init.d script with unicorn.rb configuration and terminal stdout for development.
# Add this in the environments/development.rb to view the output of the server directly from the terminal
# Config Logger.
config.logger = Logger.new(STDOUT)
config.logger.level = Logger.const_get(
ENV['LOG_LEVEL'] ? ENV['LOG_LEVEL'].upcase : 'DEBUG'
)

Keybase proof

I hereby claim:

  • I am albertogg on github.
  • I am albertogg_ (https://keybase.io/albertogg_) on keybase.
  • I have a public key ASDh51ZsWQfH1jrmZ9PW6fmDKWL5nyY4qoD6aALEZlBedgo

To claim this, I am signing this object:

@albertogg
albertogg / redcarpet.rb
Last active December 22, 2015 14:59
Rails markdown template handler with redcarpet.
# config/initializers/redcarpet.rb
module ActionView
class Template
module Handlers
class Markdown
class_attribute :default_format
self.default_format = Mime::HTML
def call(template)
@albertogg
albertogg / .gemrc
Last active December 15, 2015 16:08 — forked from jnx/rbenv-install-system-wide.sh
Install VPS with ruby, rbenv, nginx, mysql.
echo "gem: --no-ri --no-rdoc" > ~/.gemrc
@albertogg
albertogg / nginx.conf
Last active December 12, 2015 10:38
nginx configuration file with server block unicorn ready.
user deploy;
worker_processes 1;
pid /var/run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
@albertogg
albertogg / nginx_gunicorn.conf
Created December 31, 2012 19:40
nginx server block = sites-enabled + gunicorn
# You may add here your
# server {
# ...
# }
# statements for each of your virtual hosts to this file
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
@albertogg
albertogg / deploy.rb
Created October 5, 2012 01:59
Capistrano deploy.rb with rbenv, unicorn and nginx.
require 'bundler/setup'
server "some-ip", :web, :app, :db, primary: true
default_run_options[:pty] = true
ssh_options[:forward_agent] = true
set :application, "application-name"
set :repository, "git@git"
set :user, "deploy" # As defined on your server

Keybase proof

I hereby claim:

  • I am albertogg on github.
  • I am albertogg (https://keybase.io/albertogg) on keybase.
  • I have a public key whose fingerprint is 6E86 AD68 E087 4404 D6DA 243F 28B4 4A17 CC9C 6981

To claim this, I am signing this object: