Skip to content

Instantly share code, notes, and snippets.

View skwashd's full-sized avatar
👨‍💻
planning, coding, reviewing

Dave Hall skwashd

👨‍💻
planning, coding, reviewing
View GitHub Profile
@skwashd
skwashd / README.md
Created January 16, 2018 02:42
Purge GitHub Invites

Purge GitHub Invites

Large organisations invite new users to GitHub all the time. Some times the user never accepts the invite. GitHub invites never expire. Long after the user has been forgotten they can still accept the invite. This is a potential security issue.

Back in September 2015 I asked GitHub to expose invite information via their API. In December 2016 GitHub launched their new Organization Memberships APIs, which included an endpoint for pending invitations. The initial implementation lacked information of when the invite was sent. GitHub added this property after I asked for it.

I created a script that uses this new API that checks for any invites which have been pending more than a week. If they exist they're pruged. I hope someone else finds this usef

@skwashd
skwashd / cf-tls12-only.sh
Created October 31, 2017 16:20
Disable old versions of TLS for all domains on Cloudflare
#!/bin/sh
# Enable modern TLS only mode for all sites on Cloudflare (max 50)
#
# Written by Dave Hall <[email protected]>
# CC-0 License applies - https://creativecommons.org/publicdomain/zero/1.0/
BASE_URI="https://api.cloudflare.com/client/v4"
if [[ -z "${AUTH_EMAIL}" ]]; then
@skwashd
skwashd / README.md
Last active July 20, 2017 10:57
Don't be the next Dow Jones

I'm not Dow Jones

This script will audit your S3 buckets and flag those with configuration that might cause you to be the next Dow Jones.

Quick Start

  • Clone this gist - git clone https://gist.github.com/8bfcd7096558044dc84689ac05575fa8.git im-not-dow-jones
  • Change into the newly created directory - im-not-dow-jones
  • Install the dependencies - pip install -r requirements.txt
  • Setup your AWS credentials - aws configure (The account will need full access to your S3 buckets)
  • Set the excute bit on the script - chmod +x im-not-dow-jones.py
<?php
$aliases['local'] = array(
'uri' => 'http://dev.example.com',
'root' => '~/www',
);
@skwashd
skwashd / README.md
Last active September 12, 2020 18:01
Export stored passwords from Google Chrome to 1Password

This code snippet is for exporting passwords stored in Google Chrome for use in 1Password. It generates a 1Password compatiable CSV file.

NOTE: Your password are exported as plain text. Take proper precautions when storing the file and use a secure deletion tool.

To export your passwords follow these steps:

  • visit chrome://settings-frame/passwords
  • Open the Chrome console (Mac: [Cmd] + [Option] + J / Windows or Linux: [Ctrl] + [Shift] + J`)
from robot import Robot
from ultrasonic import Ultrasonic
us = Ultrasonic(13, 15)
rbt = Robot(us)
rbt.auto_pilot()
@skwashd
skwashd / ruleset.xml
Created October 21, 2016 15:36
Combined Drupal Coding and Best Practice Standards Ruleset for PHP CodeSniffer
<?xml version="1.0"?>
<ruleset name="Combined Drupal Standard">
<rule ref="Drupal" />
<rule ref="DrupalPractice" />
</ruleset>
@skwashd
skwashd / resources.md
Last active November 13, 2016 10:18
DrupalCon Dublin: Let the Machines do the Work
@skwashd
skwashd / README.md
Last active May 27, 2020 07:24
Drupal git pre-commit hook

This pre-commit hook is designed to be used for Drupal 7 and 8 sites.

Download the pre-commit file. Save it as .git/hook/pre-commit in your git repo. You need to ensure that the file is executable.

If you want this to be added to all new projects automatically, add it to your git init templates.

To install and PHP CodeSniffer for Drupal, please read the official documentation.

To see this working checking out this short YouTube video.

@skwashd
skwashd / .travis.yml
Created June 29, 2016 13:05
Incrementally improve your Drupal code
language: php
sudo: false
php:
- 5.6
install:
# Remove xdebug to make composer faster.
- phpenv config-rm xdebug.ini