Skip to content

Instantly share code, notes, and snippets.

@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 / 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: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
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 / 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
@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;
#!/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 / postgresql_install.sh
Created November 4, 2022 22:16 — forked from coder4web/postgresql_install.sh
PostgreSQL install and setup
:'SET PASSWORD
sudo -i -u postgres
psql
\password postgres
'
# RHEL / CentOS 8
# https://www.postgresql.org/download/linux/redhat/
# https://www.postgresql.org/docs/current/runtime.html
dnf list installed |grep postgresql
# Make sure to export the instance ID
# export instance_id=$(curl -s http://169.254.169.254/latest/meta-data/instance-id)
import boto3
import os
from botocore.exceptions import ClientError
ec2 = boto3.client('ec2', region_name='us-east-1')
volume_info = ec2.describe_volumes(
Filters=[
{
@jdmedeiros
jdmedeiros / Graphical_User_Interface_On_EC2
Last active February 2, 2023 08:07
Graphical User Interface (GUI) on AWS EC2 Linux-2
Installing a Graphical User Interface (GUI) on AWS EC2 Linux-2
sudo amazon-linux-extras install mate-desktop1.x
sudo amazon-linux-extras install epel
sudo amazon-linux-extras install chromium filezilla
sudo yum -y install xrdp chromium filezilla
sudo systemctl enable --now xrdp
# This will make the graphic interface available to all users
sudo bash -c 'echo PREFERRED=/usr/bin/mate-session > /etc/sysconfig/desktop'