Skip to content

Instantly share code, notes, and snippets.

@devton
devton / README.md
Last active January 20, 2026 15:43
br banks holidays forfun

Mini API de Feriados Bancários no Brasil

Descrição

Esta é uma mini API em Go que fornece uma lista de feriados bancários nacionais no Brasil. A aplicação baixa os dados do site da FEBRABAN, os armazena em um banco de dados e os expõe através de um endpoint de API RESTful.

O projeto foi construído como um exercício para demonstrar a criação de uma API em Go, web scraping e interação com um banco de dados.

Funcionalidades

Linux Systemd Hardening via Strace Profiling

This skill outlines a methodology for determining the minimal systemd security configuration for any application by profiling its runtime behavior using strace.

1. Filesystem Hardening (ReadWritePaths, ReadOnlyPaths)

Goal: Determine strictly which paths the application reads and writes to.

profiling

Run the application in the foreground (if possible) or attach to the process.

@devton
devton / Rakefile
Created June 1, 2018 14:49 — forked from schickling/Rakefile
Activerecord without Rails
require "active_record"
namespace :db do
db_config = YAML::load(File.open('config/database.yml'))
db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'})
desc "Create the database"
task :create do
ActiveRecord::Base.establish_connection(db_config_admin)
Verifying my Blockstack ID is secured with the address 1JDwi1ANgzVi7LvQGg5iuoqyitqmpMXJc4 https://explorer.blockstack.org/address/1JDwi1ANgzVi7LvQGg5iuoqyitqmpMXJc4
@devton
devton / git-aliases.md
Created March 17, 2016 18:52 — forked from mwhite/git-aliases.md
The Ultimate Git Alias Setup

The Ultimate Git Alias Setup

If you use git on the command-line, you'll eventually find yourself wanting aliases for your most commonly-used commands. It's incredibly useful to be able to explore your repos with only a few keystrokes that eventually get hardcoded into muscle memory.

Some people don't add aliases because they don't want to have to adjust to not having them on a remote server. Personally, I find that having aliases doesn't mean I that forget the underlying commands, and aliases provide such a massive improvement to my workflow that it would be crazy not to have them.

The simplest way to add an alias for a specific git command is to use a standard bash alias.

# .bashrc
@devton
devton / ubuntu_ec2_ruby_2.2.1_setup.sh
Last active August 29, 2015 14:18
ec2 ubuntu ruby 2.2.1 and small fullstack dependencies
echo "installing depencies..."
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev nodejs rbenv ImageMagick libmagickwand-dev build-essential postgresql postgresql-common libpq-dev imagemagick nginx libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev -y
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc
if [ ! -d ~/.rbenv/plugins/ruby-build ]; then git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build; fi
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
rbenv install 2.2.1 -s
How to setup Heroku Hostname SSL with GoDaddy SSL Certificate and Zerigo DNS
Heroku recently added an exciting new 'Hostname SSL' option. This option offers the broad compatibility of IP-based SSL, but at 1/5 the price ($20 / month at the time of this writing).
The following tutorial explains how to use Heroku's new 'Hostname SSL' option on your Heroku project. Before we begin, let's list what we're using here:
* Heroku Hostname SSL
* GoDaddy Standard SSL Certificate
* Zerigo DNS
@devton
devton / crawler.rake
Created February 11, 2015 00:27
crawler.rake
namespace :crawler do
desc 'Start the crawler on a URL'
task :start, [:url] => [:environment] do |t, args|
Rails.logger.info "starting crawler on --> #{args[:url]}"
links = Crawler::Web.collect_links_from args[:url]
CrawledUrl.transaction do
links.each do |url|
CrawledUrl.persist_from url
end
end
@devton
devton / crawled_url.rb
Created February 10, 2015 23:39
CrawledUrl Model
class CrawledUrl < ActiveRecord::Base
# Persiste uma URL no banco de dados
# caso ela já não tenha sido persistida ou
# não tenha nenhuma expressão negativa
def self.persist_from url
self.find_or_create_by ::Crawler::UrlParser.parse(url) unless NegativeExpression.url_match?(url)
end
end
@devton
devton / crawled_url_spec.rb
Created February 10, 2015 23:34
CrawledUrlSpec
require 'rails_helper'
RSpec.describe CrawledUrl, :type => :model do
describe ".persist_from" do
let(:url) { 'http://www.foo.bar.com/foo-bar#lorem?ipsum=dolor' }
let(:attributes) { ::Crawler::UrlParser.parse url }
subject { CrawledUrl.persist_from url }
context "when url already persisted" do