Skip to content

Instantly share code, notes, and snippets.

View Ralnoc's full-sized avatar

James T. Boylan Ralnoc

  • Grubhub
  • Chicago, IL
View GitHub Profile
@Ralnoc
Ralnoc / create-vm-template
Last active November 4, 2024 11:52
Take QCOW2 disk image and build a VM Template for Proxmox
#!/usr/bin/env bash
RED='\033[0;31m'
LIGHTRED='\033[1;31m'
GREEN='\033[0;32m'
LIGHTGREEN='\033[1;32m'
BROWN='\033[0;33m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
LIGHTBLUE='\033[1;34m'
#!/bin/bash
if [[ ! -f /usr/local/bin/brew ]]
then
echo "Missing Homebrew. Will now install so that pyenv installation can continue..."
read -p "Press CTRL-C to cancel or Enter to continue..."
mkdir homebrew && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
fi
echo "Installing pyenv..."
#!/bin/bash
set -e
echo "Installing required dependencies..."
sudo apt-get install -y build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev python-openssl git
echo "Installing pyenv..."
@Ralnoc
Ralnoc / tornadosse.py
Created October 21, 2019 02:39 — forked from mivade/tornadosse.py
Tornado server-sent events
"""Demonstration of server-sent events with Tornado. To see the
stream, you can either point your browser to ``http://localhost:8080``
or use ``curl`` like so::
$ curl http://localhost:8080/events
"""
import signal
from tornado import web, gen
@Ralnoc
Ralnoc / helloevolve.py
Created February 21, 2017 14:26
helloevolve.py - a simple genetic algorithm in Python (Updated for Python 3)
"""
helloevolve.py implements a genetic algorithm that starts with a base
population of randomly generated strings, iterates over a certain number of
generations while implementing 'natural selection', and prints out the most fit
string.
The parameters of the simulation can be changed by modifying one of the many
global variables. To change the "most fit" string, modify OPTIMAL. POP_SIZE
controls the size of each generation, and GENERATIONS is the amount of
generations that the simulation will loop through before returning the fittest
string.
@Ralnoc
Ralnoc / .tmux.conf-2.2
Created June 10, 2016 11:09
Tmux 2.2 Config
set-option -g status-utf8 on
set-option -g status-justify left
set-option -g status-bg black
set-option -g status-fg white
set-option -g status-left-length 40
set-option -g pane-active-border-fg green
set-option -g pane-active-border-bg black
set-option -g pane-border-fg white
set-option -g pane-border-bg black
@Ralnoc
Ralnoc / .tmux.conf-2.1
Last active June 10, 2016 11:09
Tmux 2.1 Config
set-option -g status-utf8 on
set-option -g status-justify left
set-option -g status-bg black
set-option -g status-fg white
set-option -g status-left-length 40
set-option -g pane-active-border-fg green
set-option -g pane-active-border-bg black
set-option -g pane-border-fg white
set-option -g pane-border-bg black
@Ralnoc
Ralnoc / mnt-chrt-root-drive.sh
Last active June 10, 2016 11:07
Mount and chroot into a root partition from a livecd
sudo mount $1 /mnt
for i in /sys /proc /run /dev /dev/pts; do sudo mount --bind "$i" "/mnt$i"; done
sudo cp /etc/resolv.conf /mnt/etc/
sudo chroot /mnt
@Ralnoc
Ralnoc / .sagent
Last active March 25, 2022 23:23
SSH Agent Management Bash Command
## SSH-Agent Manager
# Command list:
# sagent new - Generate new ssh-agent instance
# sagent [list] - List all ssh-agent instances along with keys they have loaded
# sagent <number> - Select ssh-agent instance based on number shown in sagent list
# sagent add </path/to/keyfile> - Add ssh key to currently selected ssh-agent
# sagent purgedead - Remove files related to dead ssh-agent instances
@Ralnoc
Ralnoc / extract_access.py
Created June 5, 2015 13:07
Extract Apache combined access log lines within a defined time range and send to either local destination or remote destination using SFTP.
#!/bin/env python
import datetime
import paramiko
import re
import tempfile
def parse_args():
import optparse
import sys