Skip to content

Instantly share code, notes, and snippets.

View joaompinto's full-sized avatar

João Pinto joaompinto

View GitHub Profile
TXT ="""
server.1 = something
server.2 = else
alone = testing
"""
def props2dict(config_data):
lines = config_data.splitlines()
lines = [l for l in lines if '=' in l] # Ignore non formatted lines
@joaompinto
joaompinto / login.sh
Created February 18, 2016 17:07
Connect to system with expect
#!/usr/bin/expect -f
set target [lindex $argv 0];
set timeout 60
# Request the login password
stty -echo
send_user -- "Password for $target: "
expect_user -re "(.*)\n"
@joaompinto
joaompinto / accesslog2influxdb.yaml
Created April 12, 2019 14:45
accesslog2influxdb.yaml
start:
- read from file list: www.openpipe.org/access*
- iterate: # Produce invididual elements
# Process any filed obtained from the file list
- read from file:
path: $_$
mime_type: "text/plain"
@joaompinto
joaompinto / basebuild.sh
Last active June 15, 2019 09:18
basebuild.sh
#!/bin/sh
udocker pull debian:stable-slim # ≃ 22MB
CID=$(udocker create --name=build debian:stable-slim) # ≃ 62MB
udocker run $CID << _EOF_
apt-get update
apt-get upgrade
apt-get install -y gcc g++ bison bzip2 gawk make patch perl python3 texinfo # ≃ 351MB
#!/usr/bin/python3
from os import statvfs
from pprint import pprint
with open('/proc/mounts') as mounts_file:
mount_data = mounts_file.read().splitlines()
pprint(mount_data)
mount_points = map(lambda x: x.split()[1], mount_data)
for mount_path in mount_points:

Keybase proof

I hereby claim:

  • I am joaompinto on github.
  • I am joaompinto (https://keybase.io/joaompinto) on keybase.
  • I have a public key whose fingerprint is 44C9 EAAC D815 D09B 6121 C069 D146 43C2 83C8 DDD5

To claim this, I am signing this object:

#!/usr/bin/python3
# Apply multiplier to duration string ('hh:mm')
# python3 multiply_duration.py 08:30 0.9 # 90% of a day
# python3 multiply_duration.py 08:30 5 # 5 days
import sys
def multiplty_duration(duration, multiplier):
kind delete cluster
kind create cluster
export OPERATOR_VERSION=v2.0.0-0.g0142d1e9
kubectl create ns cf-operator
helm install cf-operator \
--namespace cf-operator \
--set "global.operator.watchNamespace=kubecf" \
https://s3.amazonaws.com/cf-operators/helm-charts/cf-operator-${OPERATOR_VERSION}.tgz
@joaompinto
joaompinto / standaalone-python-install.sh
Created May 18, 2021 18:33
Install standalobe python on Windows
#!/bin/sh
set -eu
cd /tmp
function setup_profile() {
cat >> ~/.bashrc << _EOF_
export PATH=~/usm/python/install:~/usm/python/install/Scripts:\$PATH
_EOF_
}
curl -Lo ~/.local/bin/cfssljson https://github.com/cloudflare/cfssl/releases/download/v1.6.3/cfssljson_1.6.3_linux_amd64
curl -Lo ~/.local/bin/cfssl https://github.com/cloudflare/cfssl/releases/download/v1.6.3/cfssl_1.6.3_linux_amd64
chmod 755 ~/.local/bin/cfssl*
# Creating the Certificate Authority
cat > ca-csr.json << _EOF_
{
"CN": "Prototype Test Certificate Authority",
"key": {
"algo": "rsa",