Skip to content

Instantly share code, notes, and snippets.

View helderjnpinto's full-sized avatar
☢️

ħþ helderjnpinto

☢️
View GitHub Profile
@helderjnpinto
helderjnpinto / postgres_queries_and_commands.sql
Last active January 25, 2023 16:31 — forked from rgreenjr/postgres_queries_and_commands.sql
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%'
@helderjnpinto
helderjnpinto / docker-compose.yml
Created December 9, 2022 22:01 — forked from barnybug/docker-compose.yml
Docker compose for a Docker-in-docker gitlab runners setup
# Docker-in-Docker Gitlab runners setup taken from:
# https://medium.com/@tonywooster/docker-in-docker-in-gitlab-runners-220caeb708ca
dind:
restart: always
privileged: true
volumes:
- /var/lib/docker
image: docker:17.09.0-ce-dind
command:
- --storage-driver=overlay2
@helderjnpinto
helderjnpinto / git_submodules.md
Created November 26, 2019 16:02 — forked from gitaarik/git_submodules.md
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of advantages of using submodules:

  • You can separate the code into different repositories.
@helderjnpinto
helderjnpinto / sshuttle-opts.sh
Created August 30, 2019 13:28 — forked from ThinGuy/sshuttle-opts.sh
Pass sshuttle ssh options to get around remote hosts whose identification changes often (testt/dev/ops systems)
# It is possible to paas sshuttle common ssh options such as UserKnownHostsFile, StrictHostIPChecking, CheckHostIP etc
# Normal sshuttle command:
sshuttle -r ubuntu@<some-ip>:2222 <remote_subnet(s)/CIDR>
# In the above scenario, for most systems, StrictHostKeyChecking, and all other good security features will be in effect.
# That's normally a good thing, except when it's not. Like when you have to continually clean a known hosts file because
# your testing different build options and the remote host's ECDSA, DSA, RSA <or whatever> keeps changing.
# By making use of the -e option you can control how sshuttle uses ssh. Any option your ssh-client supports can be passed.
@helderjnpinto
helderjnpinto / install_elixir.md
Created April 12, 2019 08:23 — forked from rubencaro/install_elixir.md
Elixir installation guide

Elixir installation guide

Version numbers should be the ones you want. Here I do it with the last ones available at the moment of writing.

The simplest way to install elixir is using your package manager. Sadly, at the time of writing only Fedora shows the intention to keep its packages up to date. There you can simply sudo dnf install erlang elixir and you are good to go.

Anyway, if you intend to work with several versions of erlang or elixir at the same time, or you are tied to a specific version, you will need to compile it yourself. Then asdf is your best friend.

FROM openjdk:8u181-jre-alpine3.8
ARG version
RUN apk add --update libc6-compat && \
rm -rf /var/cache/apk/*
RUN mkdir /opt
RUN wget -O /tmp/pantheon.tar.gz https://bintray.com/consensys/pegasys-repo/download_file?file_path=pantheon-$version.tar.gz && \
@helderjnpinto
helderjnpinto / _.deep.js
Created November 29, 2018 21:41 — forked from furf/_.deep.js
underscore.js mixin for plucking nested properties
_.mixin({
// Get/set the value of a nested property
deep: function (obj, key, value) {
var keys = key.replace(/\[(["']?)([^\1]+?)\1?\]/g, '.$2').replace(/^\./, '').split('.'),
root,
i = 0,
n = keys.length;
@helderjnpinto
helderjnpinto / mocha-guide-to-testing.js
Created November 29, 2018 15:13 — forked from samwize/mocha-guide-to-testing.js
Explain Mocha's testing framework - describe(), it() and before()/etc hooks
// # Mocha Guide to Testing
// Objective is to explain describe(), it(), and before()/etc hooks
// 1. `describe()` is merely for grouping, which you can nest as deep
// 2. `it()` is a test case
// 3. `before()`, `beforeEach()`, `after()`, `afterEach()` are hooks to run
// before/after first/each it() or describe().
//
// Which means, `before()` is run before first it()/describe()
@helderjnpinto
helderjnpinto / bitsquat.py
Created November 23, 2018 11:40 — forked from temoto/bitsquat.py
DNS domain bitsquat checker
#!/usr/bin/env python
from __future__ import unicode_literals
# Original idea: http://dinaburg.org/bitsquatting.html
import gevent.monkey
gevent.monkey.patch_all()
import dns.name, dns.resolver
import gevent, gevent.pool
import sys
const fs = require("fs");
const solc = require('solc')
let Web3 = require('web3');
let web3 = new Web3();
web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545'));
var input = {
'strings.sol': fs.readFileSync('strings.sol', 'utf8'),
'StringLib.sol': fs.readFileSync('StringLib.sol', 'utf8'),