This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: | |
:: This script installs wormhole (https://github.com/warner/magic-wormhole) and | |
:: its prerequisites. Run this as an administrator. | |
:: | |
:: Install chocolatey. | |
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" | |
:: Install Python 3. | |
choco install -y python |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is my stream-of-consciousness attempt to figure out why | |
# https://twitter.com/asdizzle_/status/890496680495374336 works. | |
# | |
# As the tweet says, many validator techniques (filters and WAFs?) prohibit | |
# spaces, $, {, or } and such. This uses shell-fu to get around that by using | |
# command substitution (the backticks). | |
# | |
# Basically, everything in backticks is evaluated before the shell executes | |
# the "real" command, uname. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Parse RideAustin data from https://data.world/andytryba/rideaustin/file/RideAustin_Weather.csv | |
""" | |
import argparse | |
import pandas | |
from dateutil import parser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Wrap text to fixed length with Go (demo). | |
package main | |
import ( | |
"go/doc" | |
"os" | |
) | |
const lorem = `Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This demonstrates a little bit of how Unix directories work, re late-night chat with Bujol about Facebook Haystack. | |
// | |
// (Go makes this clearer than languages like Python or Ruby generally do.) | |
package main | |
import ( | |
"bytes" | |
"fmt" | |
"go/doc" | |
"log" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This Enumerator#sum example from the Ruby docs is pure black magic to me: | |
# | |
# "a\nb\nc".each_line.lazy.map(&:chomp).sum("") #=> "abc" | |
# | |
# So I’mma figure out how and why it works by implementing a version of it. | |
# Sigils are Symbol-like objects that can be converted to Procs. | |
class Sigil | |
def initialize(name) | |
@name = name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure("2") do |config| | |
# Create Ubuntu 16 machine and do the following provision actions: | |
# - Update all packages. | |
# - Install git. | |
# - Install curl and wget. | |
# - Install apt-transport-https and ca-certificates. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
"""Convert private keys saved in LastPass back to a usable format. | |
1. Copy-paste key from Secure Note to a local file. | |
2. Run this script passing the file as an argument. | |
3. Formatted key prints to stdout. | |
Example: | |
python rebuild_key.py ~/.ssh/keys/why_lastpass_why > ~/.ssh/keys/fixed | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
"""Reject commits to Ansible projects that contain unencrypted vault files. | |
I realized pretty quick that a simple shell script could so the same thing (see | |
https://gist.github.com/princebot/2bd84b3b344168db22ce1259241f4a88) — but I | |
finished this anyway for funsies. | |
Also for funsies, I wanted to see what static classes in Python might look like. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
# Name: pre-commit | |
# Author: [email protected] | |
# Synopsis: Reject commits containing unencrypted Ansible Vault files. | |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
set -e | |
vault_files=($(IFS=$'\n' find . -type f -name 'vault')) |
NewerOlder