Skip to content

Instantly share code, notes, and snippets.

View widdowquinn's full-sized avatar

Leighton Pritchard widdowquinn

View GitHub Profile
@widdowquinn
widdowquinn / kali_osx_persistence_wifi.md
Last active January 28, 2024 06:32
Kali Linux Live USB with persistence and wireless on Macbook Pro

Kali Linux Bootable USB with Persistence and Wireless on OSX

Download the appropriate Kali Linux .iso

I used a 64 bit .iso image, downloaded via HTTP. I downloaded the amd64 weekly version, as the pool linux headers (needed below for installation of wireless drivers) were ahead of the stable release kernel.

Download the SHA256SUMS and SHA256SUMS.gpg files from the same location.

@widdowquinn
widdowquinn / emacs_python_ide.md
Last active April 27, 2023 17:36
Turning Emacs into a Python IDE

Turning emacs into a Python IDE

## Create a new config/initialisation file

Create a user-level initialisation file init.el:

touch .emacs.d/init.el
@widdowquinn
widdowquinn / boy-girl.py
Created March 10, 2013 13:02
Python code to illustrate the Tuesday Boy paradox ("I have two children. One is a boy born on a Tuesday. What is the probability I have two boys") for a blog post. This time, unlike paradox.py, parents with one child of either sex are free to choose which child they tell you about, and rephrase the question accordingly.
# boy-girl.py
#
# Python code to illustrate the Tuesday Boy paradox ("I have two children.
# One is a boy born on a Tuesday. What is the probability I have two boys")
# for a blog post.
#
# This time, unlike paradox.py, we're not assuming that there is preselection
# for telling you that one of the children is a boy, or a boy born on a Tuesday.
# This radically alters the solution of the problem.
#
@widdowquinn
widdowquinn / paradox.py
Created February 9, 2013 17:32
Python code to illustrate the Tuesday Boy paradox ("I have two children. One is a boy born on a Tuesday. What is the probability I have two boys") for a blog post.
# paradox.py
#
# Python code to illustrate the Tuesday Boy paradox ("I have two children.
# One is a boy born on a Tuesday. What is the probability I have two boys")
# for a blog post.
#
# We're simulating two sampling modes to illustrate how the approach to
# sampling, and posing the initial question, is important. This has general
# implications for what we can reasonably infer from experiments where we
# did not design the experiment to answer a specific question.
@widdowquinn
widdowquinn / jupyterhub_aws.md
Created December 9, 2017 16:33
Set up JupyterHub on AWS

JupyterHub on AWS

EC2 Setup

  • Log in to AWS
  • Go to a sensible region
  • Start a new instance with Ubuntu Trusty (14.04) - compute-optimised instances have a high vCPU:memory ratio, and the lowest-cost CPU time. c4.2xlarge is a decent choice.
  • Set security group (firewall) to have ports 22, 80, and 443 open (SSH, HTTP, HTTPS)
  • If you want a static IP address (for long-running instances) then select Elastic IP for this VM
  • If you want to use HTTPS, you'll probably need a paid certificate, or to use Amazon's Route 53 to get a non-Amazon domain (to avoid region blocking).
@widdowquinn
widdowquinn / github_pages_jekyll_minimal_mistakes.md
Created December 19, 2017 17:56
Create a Jekyll blog on GitHub Pages, using the Minimal-Mistakes Theme

Creating a Jekyll blog on GitHub Pages with Minimal-Mistakes

Setup

First, create a new Jekyll site and corresponding GitHub Pages repository, then test it locally at http://localhost:4000:

$ gem install jekyll bundler
$ jekyll new <REPO>/
Running bundle install in /Users/<USER>/Development/GitHub/<REPO>... 
@widdowquinn
widdowquinn / pca_prcomp_explanation.R
Last active September 10, 2020 20:48
A short explanation of prcomp in R, using R's example data
require(graphics)
# Let's use some example data from the R libraries: USArrests
# Have a quick look at the data
head(USArrests)
summary(USArrests)
# You should see that the measured variables are on
# different scales: Assault varies from 45 to 337, but
# all other variables only from 1 to 90.
# If we use raw values, it's possible that the absolutely,
import seaborn
from itertools import combinations
def is_multiegg(breakfast):
if sum([1 in breakfast, 2 in breakfast, 3 in breakfast]) > 1:
return True
return False
# See Twitter:
@widdowquinn
widdowquinn / restarting_and_upgrading_mediawiki_after_OSX_High_Sierra_upgrade.md
Last active December 9, 2017 16:41
Guide to upgrading and restarting MediaWiki after Sierra -> High Sierra upgrade
@widdowquinn
widdowquinn / gist:f9df8005399431d4aa5c49e9bb7ea0c6
Created May 15, 2017 13:23
Installing `ete3` under Python on OSX in a virtual environment
1) We’re going to do this in a virtual environment, so we don’t pollute the main `Python` installation:
- Change to a suitable clean directory that you can work in
- **YOU NEED TO MAKE SURE THAT THE PATH TO THIS DIRECTORY CONTAINS NO SPACES!** If the path contains spaces, `sip` will fail
- Create a new `Python` virtual environment:
```bash
virtualenv venv-test-ete3 -p python3
```