Skip to content

Instantly share code, notes, and snippets.

View 0xradical's full-sized avatar

Thiago Brandão 0xradical

View GitHub Profile
@0xradical
0xradical / alias_matchers.md
Created January 30, 2024 03:06 — forked from JunichiIto/alias_matchers.md
List of alias matchers in RSpec 3

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value
@0xradical
0xradical / git_rebase.md
Created July 12, 2023 14:14 — forked from ravibhure/git_rebase.md
Git rebase from remote fork repo

In your local clone of your forked repository, you can add the original GitHub repository as a "remote". ("Remotes" are like nicknames for the URLs of repositories - origin is one, for example.) Then you can fetch all the branches from that upstream repository, and rebase your work to continue working on the upstream version. In terms of commands that might look like:

Add the remote, call it "upstream":

git remote add upstream https://github.com/whoever/whatever.git

Fetch all the branches of that remote into remote-tracking branches, such as upstream/master:

git fetch upstream

@0xradical
0xradical / dnsmasq.conf
Created July 26, 2022 11:48 — forked from mortn/dnsmasq.conf
Dnsmasq.conf as DHCP with PXE and DNS with selective suffix/domain-search (yeah baby, it works like a charm!)
domain-needed
bogus-priv
strict-order
no-resolv
no-poll
server=8.8.8.8
server=8.8.4.4
server=/external.com/10.45.1.59
server=/dom.test/10.0.0.200
local=/home.local/
@0xradical
0xradical / instructions.md
Created July 21, 2022 17:44 — forked from bitoiu/self-signed-wildcard-cert-for-ghes.md
Self-Signed Wildcard certificate with SAN using openssl / SSL

Copy the default template of openssl.cnf to a writable location.

cp /System/Library/OpenSSL/openssl.cnf src

Uncomment the req_extensions = v3_req

req_extensions = v3_req # The extensions to add to a certificate request

Add subjectAltName to v3_req section

@0xradical
0xradical / gist:fe448807e5ad7d692736e99c16643b76
Created September 23, 2020 23:04 — forked from bkimble/gist:1365005
List local memcached keys using Ruby
#!/usr/bin/env ruby
# List all keys stored in memcache.
# Credit to Graham King at http://www.darkcoding.net/software/memcached-list-all-keys/ for the original article on how to get the data from memcache in the first place.
require 'net/telnet'
headings = %w(id expires bytes cache_key)
rows = []
@0xradical
0xradical / deep_find.rb
Last active November 12, 2019 11:34
deep_find.rb
# return path for deep find in nested hashes
def deep_find(hash, term)
paths = []
_deep_find(hash, term, root = "", paths)
paths
end
def _deep_find(hash, term, root, paths)
if hash.is_a?(Hash)
@0xradical
0xradical / credo_4.ex
Created May 22, 2018 12:08
Código exemplo em Elixir
defmodule ProntoCredoExample.Example do
@moduledoc """
This module serves as an example for
cyclomatic complexity
"""
def do_something_complex(a, b, c, d, param) do
g = 0
e = case param
@0xradical
0xradical / credo_3.groovy
Created May 22, 2018 12:06
Snippet demonstrando execução do pronto
stage ('Rodando testes') {
// ...
sh "PRONTO_GITHUB_ACCESS_TOKEN=${githubToken}"
PRONTO_PULL_REQUEST_ID=${GITHUB_PR_NUMBER} pronto run -f
github_status github_pr -c "origin/master"
//...
}
@0xradical
0xradical / credo_2.ex
Created May 22, 2018 12:03
Dependência no mix.exs
defp deps do
[
{:credo,"~> 0.8", only: [:dev, :test], runtime:false}
]
end
@0xradical
0xradical / credo_1.rb
Created May 22, 2018 12:02
Inconsistência no código
# aqui o operador de soma está separado por um espaço
def add (a, b) do: a + b
# aqui o operador de subtração não está
def subtract(a, b), do: a-b