Skip to content

Instantly share code, notes, and snippets.

View bastosmichael's full-sized avatar
🏠
Working from home

Michael Bastos bastosmichael

🏠
Working from home
View GitHub Profile
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import accuracy_score
from datetime import datetime, timedelta
import random
# Function to generate random dates
@bastosmichael
bastosmichael / update_repos.sh
Last active September 27, 2023 13:38
Automated Git Update for Sub-Directories
#!/bin/bash
# Get the current directory from which the script is executed
DIR="$(pwd)"
# Iterate over sub-directories
for SUB_DIR in "$DIR"/*; do
if [ -d "$SUB_DIR" ]; then
echo "Processing $SUB_DIR..."
@bastosmichael
bastosmichael / setup_kong_docker.sh
Last active September 19, 2023 17:57
Automated Kong Setup with Self-Signed Certificate in Docker
#!/bin/bash
# Generate a self-signed certificate
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes -subj "/CN=localhost"
# Read the contents of the certificate and private key into environment variables
CA_CERT=$(cat cert.pem)
CA_KEY=$(cat key.pem)
# Cleanup the generated certificate and key files from the local file system
@bastosmichael
bastosmichael / gist:2a5293371f9b32e5bb2411538ba982ea
Created August 10, 2023 21:11
Request for Comment (RFC) Template for Software Engineering Teams
Below is a basic RFC (Request for Comment) template suitable for software engineering teams working on Federal projects:
---
## **RFC: [Your Proposal Name]**
**RFC Number:** [Unique number or identifier for the RFC]
**Date:** [Creation date]
@bastosmichael
bastosmichael / dependabot.yml
Last active November 22, 2023 01:39
Node Dependabot Auto-merging based on pass/fail PR CI
version: 2
updates:
- package-ecosystem: 'npm' # See documentation for possible values
directory: '/' # Location of package manifests
open-pull-requests-limit: 25
schedule:
interval: 'daily'
- package-ecosystem: 'github-actions' # See documentation for possible values
directory: '/' # Location of package manifests
open-pull-requests-limit: 25
const liters = {canonical: 'liters',
metric: [{type: 'milliliters',
to: {divide: 1000},
from: {multiply: 1000}},
{type: 'centiliters',
to: {divide: 100},
from: {multiply: 100}},
{type: 'deciliters',
to: {divide: 10},
from: {multiply: 10}},
module BattleShip
class Board
SHIPS = {C: 5, B: 4, S: 3, D: 3, T: 2}
def initialize
@grid = (1...10).map {(1...10).map {'.' }}
end
def randomly_load_ships
SHIPS.each do |ship,cells|
@bastosmichael
bastosmichael / gist:9a6ca3fc2c2fdd5abf1abf0a705ea51a
Last active June 1, 2018 04:01
Adding minutes in ruby without using Time Objects
def add_minutes(time, signed_integer_minutes)
if time_regex = time.match(/(\d{1,2}+):(\d{2}+) (AM|PM)/)
total_minutes = time_regex[2].to_i + (signed_integer_minutes.abs % 60)
final_minutes = total_minutes % 60
total_hours = time_regex[1].to_i + (signed_integer_minutes.abs / 60 % 60) + (total_minutes / 60 % 60)
final_modulo_hours = total_hours % 12
@bastosmichael
bastosmichael / gist:9db6e76bf14f108e2415
Last active March 11, 2016 00:40
User information
facebook_ids = [
"cirospizzeriabeerhousegaslamp",
"lavalenciahotel",
"tendergreensfood",
"craftpizzaco",
"tapiocaexpress",
"singlefinsd",
"thebakedbear",
"artofespresso",
"julianbakery",
@bastosmichael
bastosmichael / gist:ff3006268a647858824a
Last active September 26, 2019 15:34
Facebook Graph API data available
business - The Business associated with this Page. Visible only with a page access token or a user access token that has admin rights on the page
can_checkin - Whether this page has checkin functionality enabled - bool
can_post - Whether the current session user can post on this Page - bool
category - The Page's category. e.g. Product/Service, Computers/Technology - string
category_list - The Page's sub-categories - list<pagecategory>