Skip to content

Instantly share code, notes, and snippets.

View andrerocker's full-sized avatar
🤓
Clojure / SRE

Andre Souza andrerocker

🤓
Clojure / SRE
View GitHub Profile
@brodock
brodock / logrotate_rails_application
Last active August 29, 2015 14:04
Silver Bullet Nginx Vhost Recipe for Rails application with HTTPS + Webp + Capistrano + Linux FHS
# This file should be placed at /etc/logrotate.d/
/srv/*/shared/log/*.log {
daily
missingok
dateext
rotate 30 # amount of days to keep compressed logs (you should backup it up externally)
compress
delaycompress
notifempty
@salizzar
salizzar / gist:e63ca53de0d63e433779
Last active August 29, 2015 14:06
Processing CSV files more fast with Fibers + EM.defer
require 'bundler/setup'
require 'fiber'
require 'csv'
require 'pp'
require 'eventmachine'
def a_slow_api_call(row)
sleep 0.3
row.collect(&:to_i).inject(&:+)
@andrerocker
andrerocker / sqlserver-dump.ps1
Created October 30, 2010 22:12
Powershell Script to: Export all data from yours SQLServer like mysqldump
$database_host = "<host>"
$database_name = "<database>"
$output_file = "<output_file>"
$user = "<username>"
$password = "<password>"
[system.reflection.assembly]::loadWithPartialName('Microsoft.SqlServer.SMO')
$server = new-object "Microsoft.SqlServer.Management.Smo.Server" $database_host
$server.connectionContext.loginSecure = $false
@salizzar
salizzar / Manual de sobrevivência para fechar um aluguel em pouquíssimo tempo.markdown
Last active June 13, 2019 18:35
Um guia de dicas para fechar aluguel e organizar mudança em tempo recorde

Manual de sobrevivência para fechar um aluguel em pouquíssimo tempo

Bem, se tu estás lendo este guia provavelmente estás numa situação delicada. Separação, ordem de despejo, o que for; tens pouquíssimos dias para arranjar um lugar para morar. Baseado na minha experiência, resolvi montar este guia com dicas para auxiliar nesta procura e fechar um aluguel, bem como todos os preparativos para a mudança.

Primeiro de tudo, você terá de desenvolver algumas habilidades pessoais ESSENCIAIS tais como:

  • organização
  • boa apresentação
  • persuasão
  • assertividade
@terlar
terlar / README.markdown
Last active October 11, 2019 16:07
ArchLinux on Mac Book Retina 13"
@flomotlik
flomotlik / myapp.rb
Created February 24, 2012 13:51
Using Thor subcommands
require 'thor'
require "sub"
class MyApp < Thor
desc "parentcommand SUBCOMMAND", "Some Parent Command"
subcommand "sub", Sub
end
MyApp.start
@iboard
iboard / ruby-destructor-example.rb
Last active February 12, 2022 13:54
Ruby 'Destructor' example.
class Foo
attr_reader :bar
def initialize
@bar = 123
ObjectSpace.define_finalizer( self, self.class.finalize(bar) )
end
def self.finalize(bar)
proc { puts "DESTROY OBJECT #{bar}" }
end
@futuremill-ltd
futuremill-ltd / gist:2318876
Created April 6, 2012 11:00
Building Ruby 1.9.3 package for Debian Squeeze
# From a fresh install of squeeze
apt-get install ruby rubygems # Need ruby to use fpm
gem1.8 install fpm --no-ri --no-rdoc
apt-get install build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev ncurses-dev libyaml-dev
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
tar -zxvf ruby-1.9.3-p125.tar.gz
cd ruby-1.9.3-p125
rm -rf /tmp/ruby193
@maikell
maikell / kickstart-centos7-usb.md
Created October 13, 2016 05:14
Kickstart driven CentOS 7 install from USB

Kickstart driven CentOS 7 install from USB

None of what is written below is particularly original, however, I was unable to find a method documented on the internet at the time of writing that successfully created a kickstart driven CentOS 7 USB installer.

My interest was in doing this manually as I require this USB (image) to be created from a script. Therefore, I did not look into using ISO to USB applications - in addition, these typically do not allow custom kickstart files to be used.

References

Much of the process described below was found on the CentOS Wiki page on Installing from USB key, and from the Softpanorama page on the same subject. I thoroughly recommend reading all of the latter as it highlights the shortcomings/dangers associated with the steps below.

USB key preparation

@antoniomo
antoniomo / s2distance.go
Last active March 4, 2023 15:13
Distance calculation on databases using S2 Geometry in Golang (POC)
package main
import (
"fmt"
"github.com/golang/geo/s1"
"github.com/golang/geo/s2"
)
// https://blog.nobugware.com/post/2016/geo_db_s2_geohash_database/