Skip to content

Instantly share code, notes, and snippets.

View bmcculley's full-sized avatar

bmcculley

View GitHub Profile
@bmcculley
bmcculley / README.md
Last active March 26, 2024 10:51
A Go embed example of serving static files at the root URL path.
@bmcculley
bmcculley / hostsb4.go
Last active December 27, 2023 02:26
CIDR to ip range
// before 1.18
package main
import (
"fmt"
"log"
"net"
)
func Hosts(cidr string) ([]string, error) {
@bmcculley
bmcculley / index.html
Created December 14, 2023 11:35
Basic html for testing purposes. Includes light and dark mode.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Hello, World!</title>
<style type="text/css">
html {
color-scheme: light dark;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>List Files</title>
<style type="text/css">
.table {
/* Remove spacing between table cells (from Normalize.css) */
border-collapse: collapse;
@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 / 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
#include <iostream>
class Greeting {
public:
void say_hello() {
using std::cout;
using std::endl;
int hw[13] = {72, 101, 108, 108, 111, 44, 32, 87, 111, 114, 108, 100, 33};
for (int i = 0; i < 13; i++) {
cout << char(hw[i]);
@bmcculley
bmcculley / rounding.py
Last active January 12, 2023 18:07
Visualize the difference of bankers vs. half up vs. half down vs. no rounding averages.
import math
class deciamlRounding():
def __init__(self, nums = [3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 11.5, 13.5, 14.5, 15.5, 16.5, 17.5, 18.5, 19.5, 20.5, 21.5, 22.5, 24.5, 25.5]):
self.nums = nums
# hold the averages
self.no_rounding_avg = float(0.0)
@bmcculley
bmcculley / webserver.go
Created January 9, 2023 20:42 — forked from alexisrobert/webserver.go
Tiny web server in Go for sharing a folder
/* Tiny web server in Golang for sharing a folder
Copyright (c) 2010 Alexis ROBERT <alexis.robert@gmail.com>
Contains some code from Golang's http.ServeFile method, and
uses lighttpd's directory listing HTML template. */
package main
import (
"compress/gzip"
@bmcculley
bmcculley / dummy-web-server.py
Last active November 17, 2022 04:02 — forked from bradmontgomery/dummy-web-server.py
a minimal http server in python (2/3). Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/usr/bin/env python
"""
Very simple HTTP server in python.
Usage::
./dummy-web-server.py [<port>]
Send a GET request::
curl http://localhost