Skip to content

Instantly share code, notes, and snippets.

View mksm's full-sized avatar

Ricardo Amorim mksm

View GitHub Profile
@lucasmartins
lucasmartins / atualizando_ssl_heroku.md
Last active July 6, 2017 20:45
Gerando um novo cert. SSL e atualizando no Heroku

(check the en_US version here) Gerando um novo cert. SSL e atualizando no Heroku

Para gerar um novo certificado SSL você precisa dos seguintes procedimentos:

  • @dev Gerar um .CSR (é um arquivo texto com uma chave);
  • @dev Enviar o .CSR para a entidade certificadora (TheSSLstore);
    • @dev Verificar o Ownership do domínio via email (também da pra colocar um arquivo no srv. http);
    • @dev Baixar o .CRT (vem um zip com vários .CRT);
  • @dev Criar o bundle.crt
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active May 2, 2024 22:20
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@rodw
rodw / backup-github.sh
Last active March 30, 2024 15:04
A simple script to backup an organization's GitHub repositories, wikis and issues.
#!/bin/bash
# A simple script to backup an organization's GitHub repositories.
#-------------------------------------------------------------------------------
# NOTES:
#-------------------------------------------------------------------------------
# * Under the heading "CONFIG" below you'll find a number of configuration
# parameters that must be personalized for your GitHub account and org.
# Replace the `<CHANGE-ME>` strings with the value described in the comments
# (or overwrite those values at run-time by providing environment variables).
@millisami
millisami / application.rb
Created April 7, 2012 15:31 — forked from finack/application.rb
Example Chef Deploy Revision for Rails 3+
app = node[:rails][:app]
rails_base app[:name] do
ruby_ver app[:ruby_ver]
gemset app[:gemset]
end
%w{config log pids cached-copy bundle system}.each do |dir|
directory "#{app[:app_root]}/shared/#{dir}" do
owner app[:deploy_user]
@douglasjarquin
douglasjarquin / gist:2208690
Created March 26, 2012 18:58
Amazon RDS Performance Tuning Settings
rds-modify-db-parameter-group {param-group-name} \
--parameters="name=character_set_server, value=utf8, method=pending-reboot" \
--parameters="name=collation_server, value=utf8_general_ci, method=pending-reboot" \
--parameters="name=tmp_table_size, value={DBInstanceClassMemory/16}, method=pending-reboot" \
--parameters="name=max_heap_table_size, value={DBInstanceClassMemory/16}, method=pending-reboot" \
--parameters="name=query_cache_type, value=1, method=pending-reboot" \
--parameters="name=query_cache_size, value=131072, method=pending-reboot" \
--parameters="name=table_open_cache, value=2500, method=pending-reboot" \
--parameters="name=join_buffer_size, value={DBInstanceClassMemory/64}, method=pending-reboot" \
--parameters="name=thread_cache_size, value={DBInstanceClassMemory/12582880}, method=pending-reboot" \
@kmile
kmile / xml_parser.rb
Created February 15, 2011 12:53
A small nokogiri xml reader DSL.
# A small DSL for helping parsing documents using Nokogiri::XML::Reader. The
# XML Reader is a good way to move a cursor through a (large) XML document fast,
# but is not as cumbersome as writing a full SAX document handler. Read about
# it here: http://nokogiri.org/Nokogiri/XML/Reader.html
#
# Just pass the reader in this parser and specificy the nodes that you are interested
# in in a block. You can just parse every node or only look inside certain nodes.
#
# A small example:
#
class Net::HTTP::BufferedIO < Net::BufferedIO
@@patch = false
def self.patch= v; @@patch = v; end
def rbuf_fill
return super unless @@patch
begin
@rbuf << @io.read_nonblock(BUFSIZE)
rescue Errno::EWOULDBLOCK, Errno::EAGAIN
retry unless @read_timeout