Skip to content

Instantly share code, notes, and snippets.

View bmcculley's full-sized avatar

bmcculley

View GitHub Profile
@bmcculley
bmcculley / index.js
Last active April 4, 2022 18:46
Master the Coding Interview: Data Structures + Algorithms (udemy, find nemo exercise)
// https://nodejs.org/docs/v12.22.10/api/perf_hooks.html
const {
performance
} = require('perf_hooks');
//#1 -- For loop in Javascript.
const fish = ['dory', 'bruce', 'marlin', 'nemo'];
const nemo = ['nemo'];
const everyone = ['dory', 'bruce', 'marlin', 'nemo', 'gill', 'bloat', 'nigel', 'squirt', 'darla', 'hank'];
const large = new Array(10).fill('nemo');
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/bionic64"
config.vm.define "docker-1" do |node|
node.vm.hostname = "docker-1"
config.vm.box_check_update = false
config.vm.network "public_network"
config.vm.provider "virtualbox" do |vb|
vb.name = "docker-1"
vb.memory = "2048"
@bmcculley
bmcculley / rp2g.py
Created March 7, 2022 17:28
Random pronounceable password generator
import random
def get_char(chars):
random_char = random.choice(chars)
if random.randrange(2):
return random_char.upper()
return random_char
def gen(length):
password = ""
@bmcculley
bmcculley / main.go
Created September 3, 2021 03:36
AWS example web server for learning
package main
import (
"fmt"
"net/http"
"os"
)
var hostname string
@bmcculley
bmcculley / userdata.sh
Created September 3, 2021 02:07
Install nginx on aws ec2 instance
#!/bin/bash
yum update -y
sudo amazon-linux-extras install nginx1 -y
sudo systemctl start nginx.service
sudo systemctl enable nginx.service
@bmcculley
bmcculley / app.py
Created August 15, 2021 05:34
Flask socket io
from flask import Flask, render_template, session, copy_current_request_context, jsonify
from flask_socketio import SocketIO, emit, disconnect
from threading import Lock
async_mode = None
app = Flask(__name__)
app.config['SECRET_KEY'] = 'ceafa6fe-f968-4d7d-8583-4252c5ab54a4' # change me
socketio = SocketIO(app, async_mode=async_mode)
thread = None
@bmcculley
bmcculley / example.py
Created August 15, 2021 04:26
Running a docker container from Python example.
import docker
import os
def run_container(container_name):
client = docker.from_env()
client.containers.run(container_name, ports={8080:8080}, detach=True)
def get_id(container_name):
client = docker.from_env()
from collections import Counter
def withdraw_one(amount):
bills = [100,50,20]
memo = [amount + 1] * (amount + 1)
bills_results = [[]] * (amount+1)
d = {100:0, 50:0, 20:0}
memo[0] = 0
@bmcculley
bmcculley / readme.md
Last active May 10, 2023 18:40
SRE/DevOps Challenge

SRE/DevOps Challenge

Overview

This challenge will test the following skills:

  • Kubernetes orchestration
  • CI systems
  • REST APIs
  • Scripting
@bmcculley
bmcculley / docker-compose.yaml
Last active June 22, 2021 00:08
Docker Compose File For Wordpress and MariaDB
version: '3'
services:
# Database
db:
image: mariadb:latest
volumes:
- db_data:/var/lib/mysql
restart: always
environment: