Skip to content

Instantly share code, notes, and snippets.

View immanuelpotter's full-sized avatar

Immanuel Potter immanuelpotter

View GitHub Profile
@immanuelpotter
immanuelpotter / CSQueue.java
Created May 17, 2018 20:36 — forked from secretdataz/CSQueue.java
[Java] Circular array queue implementation
/**
* Circular array queue implementation
* @author Jittapan Pluemsumran
*/
public class CSQueue<T> {
T[] data;
int first = -1;
int last = -1;
int size; // for quick access
#!/bin/bash
# Author: www.github.com/immanuelpotter
# Usage: run this script in your root project dir.
# run: "php composer.phar --create-project --prefer-dist laravel/laravel <project_name>"
# run: "cd <project_name> && php ../composer.phar install"
#check if you've got the package already
if_installed(){
PACKAGE="$1"
#!/bin/bash
# Set this in your env:
REGISTRY=<ip addr>
# Get a registry going:
docker run -d -p 5000:5000 --name registry \
-v /var/lib/docker-registry:/var/lib/registry \
-e REGISTRY_STORAGE_DELETE_ENABLED=true \
--restart=always \
<registry-ip-address>:5000/registry:2
@immanuelpotter
immanuelpotter / ks.cfg
Last active August 8, 2018 14:18
Basic template for kickstart installation of minimal images
# Prior to use: crypt passwords and add here
install
# System authorization information
auth --enableshadow --passalgo=sha512
# Use CDROM installation media
#cdrom
# Use graphical install
#graphical
# Run the Setup Agent on first boot
@immanuelpotter
immanuelpotter / funny.sh
Last active September 7, 2018 13:19
For the next time someone leaves their laptop open...
#fun:
# slower and slower terminal load with each terminal opened - remove line from ~/.bashrc to fix
echo "echo sleep 5 >> ~/.bashrc" >> ~/.bashrc
#silly:
# the never-ending reboot - edit grub menu and change run level to stop
systemctl set-default /usr/lib/systemd/system/runlevel6.target
@immanuelpotter
immanuelpotter / sas-sign.sh
Last active December 15, 2018 14:59
Signing an Azure VHD to share on the marketplace.
#!/bin/bash
RESOURCE_GROUP="$1"
OS_DISK="$2"
err_and_exit(){
if [[ -z "$RESOURCE_GROUP" || -z "$OS_DISK" ]] ; then
echo "Supply the Resource Group as argument 1. Supply the VHD image argument 2, including full path in blob storage."
fi
}
#!/bin/bash
set -ex
#####################################################################################################################
# 1. Change the aws_cmd function to match the naming of your aws credentials
# 2. Check the DATA_PATH var is where your files are ON S3 (or wherever else)
# 3. Make sure you're using the right SSH key
#####################################################################################################################
#!/bin/bash
# Run this from directory above isolinux/
DEVICE="/dev/sdb" #TODO: make this more intelligent, rather than hardcoded
PATH="/path/to/original/iso"
BUILT_NAME="custom.iso"
BOOT_COMMAND_LABEL="custom-build"
gunzip -c ${PATH}/repodata/*comps.xml.gz > comps.xml && cd isolinux && createrepo -g ../comps.xml
//We want to allow the use of two KMS keys from Account A to an IAM User in account B.
//Attach these two SIDs to your user policy in Account B.
{
"Sid": "AllowUseOfKMSKeysFromAccountA",
"Effect": "Allow",
"Action": [
"kms:Encrypt",
"kms:Decrypt",
"kms:ReEncrypt*",
@immanuelpotter
immanuelpotter / generate-encrypted-pass.py
Created August 3, 2018 12:12
Read password, hash it, print the hash
#!/usr/bin/env python3
import crypt,getpass
def prompt():
global pass1,pass2
pass1 = getpass.getpass("Enter your first password.\n")
pass2 = getpass.getpass("Enter your password again.\n")
return pass1,pass2
def make_hash(password):