Skip to content

Instantly share code, notes, and snippets.

Avatar

Fernando Correia fernandoacorreia

View GitHub Profile
View rsync-example.sh
#!/bin/bash
#
# Copies changed files to a remote server except the .git directory.
#
rsync -razvhPu -e ssh --exclude '.git' ~/Projects/forge fernando-box:/home/fedora
@fernandoacorreia
fernandoacorreia / script-template.sh
Created Dec 15, 2020 — forked from m-radzikowski/script-template.sh
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
View script-template.sh
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@fernandoacorreia
fernandoacorreia / kubectl-install.sh
Last active Apr 16, 2020
Install kubectl on Linux
View kubectl-install.sh
#!/bin/bash
curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl
chmod +x kubectl
sudo mv kubectl /usr/local/bin/
@fernandoacorreia
fernandoacorreia / run-notebook.sh
Created Feb 20, 2020
Runs Jupyter scipy-notebook in a container
View run-notebook.sh
#!/bin/bash
docker run -p 8888:8888 -v $(pwd):/home/jovyan/host jupyter/scipy-notebook
@fernandoacorreia
fernandoacorreia / convert.py
Created Feb 20, 2020
Converts KeePass CSV file to 1Password format
View convert.py
#!/usr/bin/env python
# Converts KeePass CSV file to 1Password format
import pandas as pd
import numpy as np
source_file = 'keepass.csv'
target_file = 'converted.csv'
# Read source data
View jsonpaths
#!/bin/bash
#
# Outputs JSON paths.
#
# Based on https://news.ycombinator.com/item?id=20264654
#
# Usage:
# curl -s https://raw.githubusercontent.com/sitepoint-editors/json-examples/master/src/db.json | ./jsonpaths
jq -r --stream '
@fernandoacorreia
fernandoacorreia / results.md
Last active Jan 18, 2019
Domino build times
View results.md

Results for:

git checkout 6197997b49074164bf2c6d646db1db10d466d43b; dev/deep-clean.sh; export SBT_OPTS="-Xmx4g"; time sbt domino/test:compile domino/it:compile

Dell Precision 5520

(4-core Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz; 32 GB RAM)

1291.53s user 42.03s system 307% cpu 7:14.27 total

@fernandoacorreia
fernandoacorreia / index.html
Created Nov 18, 2018
Escape the Room Escape the room // source https://jsbin.com/lomaquh
View index.html
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Escape the room">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Escape the Room</title>
</head>
<body>
<pre id="view"></pre>
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<pre id="view"></pre>
<script id="jsbin-javascript">
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<pre id="view"></pre>
<script id="jsbin-javascript">