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 / docker-machine-use-nfs.sh
Last active October 22, 2015 18:12 — forked from olalonde/docker-machine-use-nfs.sh
Use NFS instead of vboxsf in Docker Machine
#!/bin/bash
#
# This script will mount /Users in the boot2docker VM using NFS (instead of the
# default vboxsf). It's probably not a good idea to run it while there are
# Docker containers running in boot2docker.
#
# Usage: sudo ./boot2docker-use-nfs.sh
#
-- Copyright (c) 2009, Ionut Gabriel Stan. All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without modification,
-- are permitted provided that the following conditions are met:
--
-- * Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
--
-- * Redistributions in binary form must reproduce the above copyright notice,
-- this list of conditions and the following disclaimer in the documentation
require 'ap'
require 'ripper'
CLASS_TEXT = "class A; end; class B; end"
CLASS_SEXP = Ripper.sexp(CLASS_TEXT)
BIG_TEXT = "class A; def a; @a = b; end; def b; @d = a; @e = a; end; end; module B; def b; end; end"
BIG_SEXP = Ripper.sexp(BIG_TEXT)
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
@0xradical
0xradical / controller_not_dry.rb
Created November 13, 2012 12:38 — forked from bsodmike/controller_not_dry.rb
Streaming CSV file to the Client with Rails 3.1
format.csv do
@scheduled_session = Session.find(params[:id])
@applicants = @scheduled_session.applicant_signups
filename = "#{@scheduled_session.title.parameterize.downcase}_applicant_list_#{Time.now.strftime('%d%m%Y')}.csv"
headers['Content-Disposition'] = 'attachment; filename="' + filename + '"'
titles = [
"Title", "First Name", "Last Name", "DOB Day", "DOB Month", "DOB Year", "Nationality", \
"Email", "Mobile Number", "Address Line 1", "Address Line 2", "Place of Work", \
"Discipline/Speciality", "Job Title", "Key Responsibilities", "Payment Ref."
]