Skip to content

Instantly share code, notes, and snippets.

View edgurgel's full-sized avatar

Eduardo Gurgel edgurgel

View GitHub Profile
@ikuz
ikuz / nix-notes.md
Last active February 9, 2022 03:30
Nix Notes

Nix notes

Nix concepts

packages (and derivations)

  • package: a software package
  • derivation: a specific version of a software package
    • identified by a hash
@alissonsales
alissonsales / redis-protocol-awk
Last active August 7, 2018 03:54
Redis protocol in awk
awk '{ print "*" NF "\r"; for(i = 1; i <= NF; i++) { print "$" length($i) "\r\n" $i "\r" } }'
@lrascao
lrascao / gist:6880485b8dc4c51c74392b0fa5b9d358
Last active December 29, 2023 12:29
Build Erlang statically linked with OpenSSL
sudo yum install gcc gcc-c++ make libxslt fop ncurses-devel openssl-devel *openjdk-devel unixODBC unixODBC-devel
KERL_CONFIGURE_OPTIONS="--with-ssl=/home/ec2-user/openssl/releases/1.0.2h --disable-dynamic-ssl-lib" kerl build 18.3 18.3
# without ECC
KERL_CONFIGURE_OPTIONS="CFLAGS=-DOPENSSL_NO_EC=1" kerl build 18.3 18.3
@crcastle
crcastle / kafka-from-cli.md
Last active August 26, 2021 13:02
Kafka CLI example using Apache Kafka on Heroku
@josevalim
josevalim / watcher.sh
Last active February 28, 2024 07:42
A 1LOC bash script for re-running tests whenever a lib/ or test/ file changes keeping the same VM instance
# You will need fswatch installed (available in homebrew and friends)
# The command below will run tests and wait until fswatch writes something.
# The --stale flag will only run stale entries, it requires Elixir v1.3.
fswatch lib/ test/ | mix test --stale --listen-on-stdin
@tam7t
tam7t / gist:86eb4793e8ecf3f55037
Last active April 14, 2022 10:57
Securing Ruby's OpenSSL

Are your Ruby HTTPS API calls secure?

Let's check:

2.0.0-p481 :001 > OpenSSL::SSL::SSLContext::DEFAULT_PARAMS
 => {:ssl_version=>"SSLv23", :verify_mode=>1, :ciphers=>"ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW", :options=>-2147482625}
2.0.0-p481 :002 > rating = JSON.parse(RestClient::Resource.new("https://www.howsmyssl.com/a/check" ).get)['rating']
 => "Bad"
@darrencauthon
darrencauthon / 1_install_erlang.sh
Created August 28, 2014 14:27
Install Elixir v0.14.2
apt-get -y install build-essential m4 libncurses5-dev libssh-dev unixodbc-dev libgmp3-dev libwxgtk2.8-dev libglu1-mesa-dev fop xsltproc default-jdk
apt-get -y install make
apt-get -y install libncurses5-dev
mkdir -p /src/erlang
cd /src/erlang
wget http://www.erlang.org/download/otp_src_17.0.tar.gz
tar -xvzf otp_src_17.0.tar.gz
chmod -R 777 otp_src_17.0
cd otp_src_17.0
./configure
@edgurgel
edgurgel / wth.rb
Created March 28, 2014 02:02
WTH 0.0.3 formula
require "formula"
# https://github.com/Homebrew/homebrew/blob/master/Library/Formula/elixir.rb
class ErlangInstalled < Requirement
fatal true
default_formula 'erlang'
env :userpaths
satisfy {
erl = which('erl') and begin
iex(2)> Test.test1
{1474377, :ok}
iex(3)> Test.test2
{755840, :ok}
@joice
joice / flash_messages_helper.rb
Last active December 22, 2015 11:09
Flash messages helper with filter before print them
module FlashMessagesHelper
def flash_messages
safe_buffer do |html|
filtered_flash_messages.each do |name, message|
html << content_tag(:div, content_tag(:p, message), :class => "message #{name}")
end
end
end
private