Skip to content

Instantly share code, notes, and snippets.

View guitarmanvt's full-sized avatar

John Samuel Anderson guitarmanvt

View GitHub Profile
@guitarmanvt
guitarmanvt / hcl.lang
Created June 26, 2019 14:47
Hashicorp Terraform Language Specification for GtkSourceView 4 (gedit and xed) . Generated by https://github.com/guitarmanvt/cson2lang
<?xml version="1.0" encoding="UTF-8"?>
<!--
Syntax highlighting for the HashiCorp Configuration Language language
-->
<language id="hcl" name="HashiCorp Configuration Language" section="Sources" version="2.0">
<metadata>
<property name="globs">*.hcl;*.nomad;*.tf</property>
<property name="line-comment-start">//</property>
<property name="block-comment-start">/*</property>
<property name="block-comment-end">*/</property>
@guitarmanvt
guitarmanvt / jflint
Created June 18, 2019 18:19
Jenkinsfile linter
#!/bin/bash
src="${1:-Jenkinsfile}"
JENKINS_URL="https://jenkins.example.com"
function lint() {
JENKINS_CRUMB=$(curl --user USERNAME:PASSWORD -k "$JENKINS_URL/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,\":\",//crumb)")
curl --user USERNAME:PASSWORD -k -X POST -H $JENKINS_CRUMB -F "jenkinsfile=<${src}" $JENKINS_URL/pipeline-model-converter/validate
}
lint 2>/dev/null
@guitarmanvt
guitarmanvt / amen.txt
Last active March 1, 2019 02:29
Can I Get An Amen
https://youtu.be/5r9V5WV_Fbk?t=40
https://youtu.be/sJUWn-26jkw
https://youtu.be/sgJXbIP83A8?t=251
https://youtu.be/DFvKWqUPmLU
https://youtu.be/rdOIY3KH0nI
https://youtu.be/wk2Gnyiirb0?t=4
https://youtu.be/0XfKGI2o_VQ?t=225
https://youtu.be/T9ifzzMD7zk?t=164
commit 690db7d59c5dca1f814263fde11563ebe36e9b4b
Author: John Anderson <john@andersoninnovative.com>
Date: Sun Feb 17 19:16:42 2019 -0500
Scrape HTML tables to JSON
diff --git a/hello/views.py b/hello/views.py
index c248072..9616840 100644
--- a/hello/views.py
+++ b/hello/views.py
import unittest
def flatten(it):
"""Flatten an arbitrarily-nested list of integers into a single list.
Args:
it (list)
Returns: list of integers
@guitarmanvt
guitarmanvt / playmidi.py
Created February 24, 2016 13:37
Play MIDI files using pygame
# play .mid music files using PyGame on your computer's sound card
# PyGame is free from: http://www.pygame.org/news.html
# tested with Python25 and PyGame171 vegaseat 27aug2007
import pygame
def play_music(music_file):
"""
stream music with mixer.music module in blocking manner
this will stream the sound from disk while playing
"""
clock = pygame.time.Clock()
@guitarmanvt
guitarmanvt / timed_session.sh
Last active May 7, 2017 22:13
Easy timed turns on Linux for kids (automatic logout after timer ends, with 1-minute warning)
#!/bin/bash
# Requires:
# 1. at
# 2. espeak or spd-say
# 3. zenity
# 4. notify-send
# 5. MATE or Gnome desktop
talk=$(which espeak || which spd-say)
if [[ "$(which mate-session-save)" != "" ]]; then
logout="mate-session-save --force-logout"
@guitarmanvt
guitarmanvt / gist:284d05d2df62cedb1cfa
Created June 19, 2015 14:00
Craigslist - Hide Personals 2015
// ==UserScript==
// @grant none
// @name Craigslist - Hide Personals 2015
// @description This style hides the personals section on the craigslist homepages (in June 2015 anyway).
// @author guitarmanvt
// @include http://craigslist.org/*
// @include https://craigslist.org/*
// @include http://*.craigslist.org/*
// @include https://*.craigslist.org/*
// @run-at document-end