Skip to content

Instantly share code, notes, and snippets.

View peterwwillis's full-sized avatar

Peter W peterwwillis

View GitHub Profile
@MousyBusiness
MousyBusiness / bump
Last active May 31, 2023 19:57
simple script to bump semantically versioned repos
#!/usr/bin/env bash
while [[ -n "$1" ]] ; do
case "$1" in
--minor)
MINOR=true
;;
--major)
MAJOR=true
;;
@egelev
egelev / connect_bluetooth_headphones.sh
Last active March 19, 2024 09:32
Connect bluetooth headphones on Ubuntu 18.04
#!/usr/bin/env bash
function get_headphones_index() {
echo $(pacmd list-cards | grep bluez_card -B1 | grep index | awk '{print $2}')
}
function get_headphones_mac_address() {
local temp=$(pacmd list-cards | grep bluez_card -C20 | grep 'device.string' | cut -d' ' -f 3)
temp="${temp%\"}"
temp="${temp#\"}"
#!/usr/bin/env bash
set -eo pipefail
# from moby project - w/o go dependency (nailing amd64) and w/o jq dep (using
# python)
# hello-world latest ef872312fe1b 3 months ago 910 B
# hello-world latest ef872312fe1bbc5e05aae626791a47ee9b032efa8f3bda39cc0be7b56bfe59b9 3 months ago 910 B
# debian latest f6fab3b798be 10 weeks ago 85.1 MB
# debian latest f6fab3b798be3174f45aa1eb731f8182705555f89c9026d8c1ef230cbf8301dd 10 weeks ago 85.1 MB
@scrapehero
scrapehero / fandango.py
Created February 12, 2018 07:46
Python 3 Code for scraping movie details from fandango.com
from lxml import html, etree
import datetime
import requests
import re
import os
import sys
import unicodecsv as csv
import argparse
import json
# from exceptions import ValueError
@fulldecent
fulldecent / travis-local.md
Created November 29, 2017 02:33
Run Travis build locally

travis-local.md

Preconditions:

  1. POSIX or Windows system
  2. Install Docker
  3. A GitHub repo that already builds on Travis

Postcondition:

# 10_basic.py
# 15_make_soup.py
# 20_search.py
# 25_navigation.py
# 30_edit.py
# 40_encoding.py
# 50_parse_only_part.py
@plugnburn
plugnburn / README.md
Last active March 27, 2024 00:01
Statix - the simplest static website generator in bash

Statix - the simplest static website generator in Bash

Statix is a stand-alone Bash script aimed at generating full-featured, routable static websites from reusable HTML snippets. It features the most basic templating engine ever possible but allows to organize your content in a SEO-friendly way. All Statix-based websites contain these parts:

  • Templates: a directory where all HTML templates are stored
  • Route configuration: a file that maps each publicly accessible template to a SEO-friendly URL
  • Assets: a directory with optional files copied to the output website directory with no processing.

This script is also lightweight. Aside from some standard file management commands such as cp, mkdir and rm, the only serious dependency for Statix is GNU Grep compiled with PCRE support (i.e. the version that supports -P flag, included in most Linux distributions).

@tschieggm
tschieggm / flask_server.py
Created November 22, 2013 18:51
Stackdriver webhook server example
import string
import sys
import logging
import json
from flask import Flask
from flask import Response, request
logger = logging.getLogger(__name__)
logger.info("Stackdriver webhook-sample starting up on %s" % (string.replace(sys.version, '\n', ' ')))
@joyrexus
joyrexus / README.md
Last active April 8, 2024 09:15
Perl one-liners

Hi:

perl -e 'print "hello world!\n"'

A simple filter:

perl -ne 'print if /REGEX/'

Filter out blank lines (in place):

@cloudsben
cloudsben / md-menu.html
Last active June 14, 2023 07:46
markdown menu
<link rel="stylesheet" href="http://yandex.st/highlightjs/6.2/styles/googlecode.min.css">
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script src="http://yandex.st/highlightjs/6.2/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script type="text/javascript">
$(document).ready(function(){
$("h2,h3,h4,h5,h6").each(function(i,item){
var tag = $(item).get(0).localName;