Skip to content

Instantly share code, notes, and snippets.

View rpherrera's full-sized avatar

Rafael de Paula Herrera rpherrera

  • Octa6
  • Toronto, ON - Canada
View GitHub Profile
@rpherrera
rpherrera / monitor-forex.html
Created October 19, 2018 03:40
Monitor de Forex com: USD/AUD, USD/BRL, USD/EUR, USD/GBP, USD/MXN, USD/RUB, USD/CAD, Ouro, Petróleo, Brent, Petróleo, WTI, Prata, S&P500
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8"/>
<meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport">
<title>Monitor Sinistro</title>
</head>
<body>
<iframe id="monitor" frameborder="0" scrolling="no" width="510" height="275" allowtransparency="true" marginwidth="0" marginheight="0" src="https://sslfxrates.forexprostools.com/index.php?force_lang=12&pairs_ids=2091;2103;2124;2126;39;2186;7;8830;8833;8849;8836;166;170;8884;&header-text-color=%23FFFFFF&curr-name-color=%230059b0&inner-text-color=%23000000&green-text-color=%232A8215&green-background=%23B7F4C2&red-text-color=%23DC0001&red-background=%23FFE2E2&inner-border-color=%23CBCBCB&border-color=%23cbcbcb&bg1=%23F6F6F6&bg2=%23ffffff&bid=show&ask=show&last=hide&change=hide&last_update=hide"></iframe>

Keybase proof

I hereby claim:

  • I am rpherrera on github.
  • I am herrera (https://keybase.io/herrera) on keybase.
  • I have a public key ASC0-VURP6vXyUkYoLympqxuGoMCzXo1WObdqJYvLxC_Rgo

To claim this, I am signing this object:

@rpherrera
rpherrera / fix-directory-tree-permissions.sh
Created March 10, 2018 16:02
Changes the permissions from all: { directories beneath current directory to ug=rwx,o=rx (755 mode) | files beneath current directory to ug=rw,o=r (664 mode) }
#!/bin/bash
# Changes the permissions from all directories beneath current directory to ug=rwx,o=rx (755 mode)
find . -type d -exec chmod 775 {} \;
# Changes the permissions from all files beneath current directory to ug=rw,o=r (664 mode)
find . -type f -exec chmod 664 {} \;
@rpherrera
rpherrera / docker-shared-nw.md
Created February 24, 2018 05:47 — forked from kojiwell/docker-shared-nw.md
This is how to create a bridge between Docker containers and outside and create containers with the IP addresses you want to assign.

Docker - Create a Bridge and Shared Network

Sometimes I want to use Docker containers like regular VMs, creating a bridge on a Docker host, having containers on the same subnet with IP addresses I want to assign, and then logging into them via port 22. (No port forwarding, please.) So here's how to do it.

On this example, I use Vagrant and VirtualBox on my MacBook and create containers with IP addresses shown on the table below. Once you go through these steps, you should be able to extend the idea into your on-premises network.

@rpherrera
rpherrera / interacting-with-vici.py
Created February 21, 2018 18:38
Example on how you can interact with StrongSwan be means of Vici API
import vici
import json
s = vici.Session()
for i in s.list_sas():
print json.dumps(i, indent=2)
# sample output:
# {
# "rw": {
@rpherrera
rpherrera / rm-all-docker-images.sh
Created April 19, 2017 18:39
remove all docker images
#!/bin/bash
docker images -a | awk '{print $3}' | grep -v IMAGE | uniq | xargs docker rmi -f
@rpherrera
rpherrera / rm-all-killed-docker-containers.sh
Created April 19, 2017 18:36
remove all killed docker containers
#!/bin/bash
docker ps -a | awk '{print $1}' | grep -v CONTAINER | xargs docker rm -v
@rpherrera
rpherrera / star-regex.py
Created August 17, 2016 03:06
asserts the use of star feature from a pseudo-regex parser
def star_regex(regex, string):
if string:
if regex[0] == string[0]:
return star_regex(regex, string[1:])
else:
if regex[len(regex) - 1] == string[0]:
return True
else:
return False
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
@rpherrera
rpherrera / satanic-google-analytics.js
Last active July 14, 2016 05:18
instead of good and old isogram parameters, why not use this satanic version?
!function(S,A,T,a,N,I,C){S.GoogleAnalyticsObject=T;S[T]||(S[T]=function(){
(S[T].q=S[T].q||[]).push(arguments)});S[T].l=+new Date;I=A.createElement(a);
C=A.getElementsByTagName(a)[0];I.src=N;C.parentNode.insertBefore(I,C)}
(window,document,'ga','script','http://www.google-analytics.com/analytics.js');
ga('create', 'UA-XXXXX-X', 'auto');
ga('send', 'pageview');