Skip to content

Instantly share code, notes, and snippets.

Avatar

Jonathan Sharpe textbook

View GitHub Profile
@textbook
textbook / password.py
Created Sep 2, 2019
Generate moderately secure passwords
View password.py
#! /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
View README.md

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 Apr 5, 2019
Terraform crash log for issue
View crash.log
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 Feb 10, 2019
Calculate the probability of a reward in R6 Siege
View r6.py
#! /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 Oct 27, 2020
Easy commands to clean up Docker containers and images
View docker.sh
docker rm $(docker ps --all --quiet --filter status=exited)
docker rmi $(docker images --quiet --filter dangling=true)
View gist:2105272d6de7cedf0813a341cf87062c
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);
}
View demo.py
VERB_QUIET = 0
class VerbosityLevel(object):
def __init__(self, level):
self.level = level
def __get__(self, obj, _):
return obj.level >= self.level
@textbook
textbook / jsharpe.theme.bash
Created Jun 23, 2016
Adds virtualenv to Pivotal's default (bobby) bash_it theme
View jsharpe.theme.bash
#!/usr/bin/env bash
SCM_THEME_PROMPT_DIRTY=" ${red}"
SCM_THEME_PROMPT_CLEAN=" ${bold_green}"
SCM_THEME_PROMPT_PREFIX=" |"
SCM_THEME_PROMPT_SUFFIX="${green}|"
GIT_THEME_PROMPT_DIRTY=" ${red}"
GIT_THEME_PROMPT_CLEAN=" ${bold_green}"
GIT_THEME_PROMPT_PREFIX=" ${green}|"
GIT_THEME_PROMPT_SUFFIX="${green}|"
@textbook
textbook / Flask on CF.md
Last active Mar 8, 2016 — forked from ihuston/Flask on CF.md
Simple Flask application for Cloud Foundry
View Flask on CF.md

Simple Python Flask app on Cloud Foundry

This is a (very) simple Flask application that shows how the built-in Python buildpack detection on Cloud Foundry works.

To push to Cloud Foundry, log in and then use

$ cf push myapp-name

Python on Cloud Foundry

@textbook
textbook / keymap.cson
Last active Jul 9, 2016
JetBrains-style Atom keymap
View keymap.cson
# JetBrains-style
'.platform-darwin':
'cmd-1': 'tree-view:toggle'
'cmd-shift-a': 'command-palette:toggle'
'.platform-darwin .tree-view':
'cmd-1': 'tree-view:toggle'
'.platform-darwin atom-text-editor':
'cmd-b': 'symbols-view:go-to-declaration'
'cmd-d': 'editor:duplicate-lines'
'cmd-l': 'go-to-line:toggle'