Skip to content

Instantly share code, notes, and snippets.

View textbook's full-sized avatar

Jonathan Sharpe textbook

View GitHub Profile
@textbook
textbook / index.html
Last active June 23, 2020 17:08
Rewriting Proofpoint/Safelinks URLs so you can see where they actually go...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>URL Extractor</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.0/css/bulma.min.css">
</head>
<body>
import { TestBed } from '@angular/core/testing';
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
import { DemoService } from './demo.service';
fdescribe('DemoService', () => {
let service: DemoService;
let httpMock: HttpTestingController;
beforeEach(() => {
@textbook
textbook / password_creator.py
Created April 29, 2020 17:04
Simple Python password creator
from itertools import cycle
from random import choice, shuffle
from string import ascii_lowercase, ascii_uppercase, digits, punctuation
def generate_password(length: int = 20, *, use_symbols: bool = True) -> str:
"""Generate random passwords, with or without symbols.
Implementation ensures a fairly even balance of each character
class, at the cost of entropy (e.g. for a four-character password
with symbols there are only 5,191,680 possible combinations, rather
@textbook
textbook / README.md
Created October 2, 2019 09:04
How to create a pandas Series of ONS CPIH data
@textbook
textbook / password.py
Created September 2, 2019 17:17
Generate moderately secure passwords
#! /usr/bin/env python3
"""Generate moderately secure passwords.
Format: {word1}{number}{word2}{symbol}
By default, words are 8-10 characters long and the number is two digits.
Suggested word source (use words_alpha.txt):
https://github.com/dwyl/english-words

CYF Conference 2019

Code Retreat

Overview

  • Each iteration will be 35 minutes of coding, followed by a 15 minute retro, followed by a 10 minute break.
  • We will be working in pairs and using test-driven development (TDD). Pairs switch after each iteration.
  • After each iteration, we will start from scratch - delete your code! The goal is the practice, not the code.
@textbook
textbook / crash.log
Created April 5, 2019 12:39
Terraform crash log for issue
2019/04/05 12:38:38 [INFO] Terraform version: 0.11.8 7a5c1d221ac209bbac66947c369815cd9ca70ed5
2019/04/05 12:38:38 [INFO] Go runtime version: go1.10.1
2019/04/05 12:38:38 [INFO] CLI args: []string{"/home/circleci/base/e2e/terraform", "apply", "-auto-approve"}
2019/04/05 12:38:38 [DEBUG] Attempting to open CLI config file: /home/circleci/.terraformrc
2019/04/05 12:38:38 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2019/04/05 12:38:38 [INFO] CLI command args: []string{"apply", "-auto-approve"}
2019/04/05 12:38:38 [INFO] command: empty terraform config, returning nil
2019/04/05 12:38:38 [DEBUG] command: no data state file found for backend config
2019/04/05 12:38:38 [DEBUG] New state was assigned lineage "e48ff2b8-ddfe-882d-6ef9-9fbc2bf7e882"
2019/04/05 12:38:38 [INFO] command: backend initialized: <nil>
@textbook
textbook / r6.py
Last active February 10, 2019 11:14
Calculate the probability of a reward in R6 Siege
#! /usr/bin/env python3
"""Simulate the probability of a reward in R6 Siege."""
from argparse import ArgumentParser
import random
from textwrap import dedent
from typing import Mapping
@textbook
textbook / docker.sh
Last active October 27, 2020 21:10
Easy commands to clean up Docker containers and images
docker rm $(docker ps --all --quiet --filter status=exited)
docker rmi $(docker images --quiet --filter dangling=true)
var cell = new Array(3);
for (i = 0; i < 3; i++) {
cell[i] = new Array(3);
}
var newCell = new Array(3);
for (i = 0; i < 3; i++) {
newCell[i] = new Array(3);
}