Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
SCRIPT_LOG=logfile.log
# https://serverfault.com/questions/103501/how-can-i-fully-log-all-bash-scripts-actions
exec 3>&1 4>&2
trap 'exec 2>&4 1>&3' 0 1 2 3
exec 1>$SCRIPT_LOG 2>&1
source ./logger.sh
SCRIPTENTRY
@jdmedeiros
jdmedeiros / contracts...5_PicarPonto.sol
Created May 6, 2022 23:51
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.7.0;
pragma abicoder v2;
contract PicarPonto {
struct Agente {
address sender;
string cargo;
string nome;
@jdmedeiros
jdmedeiros / Readme.md
Last active April 25, 2022 13:23
Anaconda environment to setup Jupyter lab on AWS Glue endpoint

On AWS Glue dev endpoint setup Node and npm without sudo [https://www.johnpapa.net/node-and-npm-without-sudo/]

mkdir /mnt/s3/glue && cd /mnt/s3/glue
wget https://nodejs.org/dist/v16.14.2/node-v16.14.2-linux-x64.tar.xz
tar xvf node-v16.14.2-linux-x64.tar.xz 
ln -s node-v16.14.2-linux-x64 node

Add node and npm to the path modifying /home/glue/.bash_profile

$ cat /home/glue/.bash_profile
root@fw:/etc/netplan# cat 50-cloud-init.yaml
# This file is generated from information provided by the datasource. Changes
# to it will not persist across an instance reboot. To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
ethernets:
eth0:
dhcp4: true
@jdmedeiros
jdmedeiros / gist:88f07e820280dca8636e5f5741da53ec
Created February 4, 2022 12:48
Multiple interfaces on AWS EC2...
sudo cp /etc/sysconfig/network-scripts/route-eth0 /etc/sysconfig/network-scripts/route-eth0
sudo cp /etc/sysconfig/network-scripts/route-eth0 /etc/sysconfig/network-scripts/route-eth1
sudo cp /etc/sysconfig/network-scripts/route-eth0 /etc/sysconfig/network-scripts/route-eth2
@jdmedeiros
jdmedeiros / 00. tutorial.md
Created May 6, 2021 00:54 — forked from maxivak/00. tutorial.md
Importing/Indexing database (MySQL or SQL Server) in Solr using Data Import Handler
@jdmedeiros
jdmedeiros / gist:db10e100bbfecc209f00b4bb8406bc7e
Last active January 4, 2021 10:18
Northwind database for MySQL
# ---------------------------------------------------------------------- #
# Target DBMS: MySQL 5 #
# Project name: Northwind #
# Author: Valon Hoti #
# Created on: 2010-07-07 20:00 #
# ---------------------------------------------------------------------- #
DROP DATABASE IF EXISTS northwind;
CREATE DATABASE IF NOT EXISTS northwind;
@jdmedeiros
jdmedeiros / logger.sh
Created December 23, 2020 20:34
Modular approach to bash logging
#!/bin/bash
# From here https://www.cubicrace.com/2016/03/efficient-logging-mechnism-in-shell.html
# Modular approach to bash logging
#
SCRIPT_LOG=/var/log/cloud-config.log
touch $SCRIPT_LOG
function SCRIPTENTRY() {
@jdmedeiros
jdmedeiros / gist:220069b700026105bb7a9c4e185c21f9
Created December 21, 2020 13:41
GRE encapsulation in Linux: point-to-multipoint tunnels
HUB:
- Create the tunnel interface
tunnels:
mgre0:
mode: gre
remote: 0.0.0.0
local: 172.31.192.10
addresses:
- "192.168.0.100/24"
mtu: 1476
@jdmedeiros
jdmedeiros / ElegerDelegado.sol
Last active December 1, 2020 01:28
Eleição do delegado de turma do curso GRSI 2020/2021 na ENTA - Escola de Novas Tecnologias dos Açores usando o Ethereum blockchain
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.7.5;
pragma experimental ABIEncoderV2;
// https://kovan.etherscan.io/address/0x18c0417f85ae320d35138b0bb289532156a92356
contract ElegerDelegado {
string[15] nomes;