Skip to content

Instantly share code, notes, and snippets.

View squizzi's full-sized avatar

Kyle Squizzato squizzi

View GitHub Profile
@squizzi
squizzi / print_message.py
Last active March 24, 2017 18:24
A cute little message printer that doesn't need any special libraries to run
#!/usr/bin/env python
# Copyright (C) 2017, Kyle Squizzato <[email protected]>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of

Keybase proof

I hereby claim:

  • I am squizzi on github.
  • I am squizzi (https://keybase.io/squizzi) on keybase.
  • I have a public key ASD0kS49KU_989cxxqdYwhle5rc4NEpFgcLuUsxlJiR8rAo

To claim this, I am signing this object:

@squizzi
squizzi / notify_send.py
Last active August 27, 2018 14:19
Send errors through notify-send, good for use with autokey scripts
#!/usr/bin/env python
import os
from subprocess import Popen
"""
Notify users via notify-send in gnome-shell, if sending an error use is_error=True
Edit service_title with the desired title notify-send will use when sending msg
"""
def notify_msg(msg, service_title="Your service here", is_error=False):
# Determine which level we should write to
@squizzi
squizzi / halp_cant_see_sfdc_stuff.css
Last active June 22, 2017 06:27
halp can't see sfdc 'cause the fonts just are so small
/* Monospace fonts across case comments and case fields */
.caseTab .tertiaryPalette,
.individualPalette .caseBlock .tertiaryPalette,
.layoutEdit .individualPalette .caseBlock .tertiaryPalette {
background-color: #36a0fe;
border-color: #015ba7;
}
.caseTab .primaryPalette,
.individualPalette .caseBlock .primaryPalette {
background-color: #1797c0;
@squizzi
squizzi / capture-host-perf.sh
Last active June 19, 2017 19:16
Simple tool to capture performance statistics around a Docker daemon log match.
#!/bin/bash
## capture-host-performance
## Maintainer: Kyle Squizzato - [email protected]
## Simple tool to capture performance statistics around a daemon log match.
## Only supports distros using journalctl at this time.
## Fill in each of the variables in the SETUP section then invoke the script
## and wait for the issue to occur, the script will stop on it's own when
@squizzi
squizzi / task_inspect_capture.sh
Last active January 22, 2018 23:58
Inspect failed and running tasks of all services
## Diagnostic data capture for Docker services and their associated tasks
## Run where client bundle is loaded or on a swarm manager
## Use something like:
## docker service ps $each | grep -v 'ID' | awk '{print $1 " " $6}' | egrep -i 'failed|running' | awk '{print $1}';
## to grep out specific states within TASK_ID
## ---
# Create a directory to store this data in
DIRECTORY="$(pwd)/docker-service-info/"
mkdir -p $DIRECTORY
@squizzi
squizzi / calendars_are_fun.sh
Created January 30, 2018 17:04
stupid script to make my calendar icon reflect the date
# Replace the calendar icon with the correct date daily
string=$(date +%d)
if [ ${#string} -le 2 ]; then
string=$(printf %02d $string)
fi
sed -i "s/calendar-blue-[0-9][0-9]*/calendar-blue-$string/" ~/.local/share/applications/chrome-ejjicmeblgpmajnghnpcppodonldlgfn-Profile_2.desktop
@squizzi
squizzi / capture-host-performance-docker
Last active February 15, 2018 19:28
capture host performance following a docker logs $container_name match
#!/bin/bash
## capture-host-performance
## docker logs edition
## Maintainer: Kyle Squizzato - [email protected]
## Simple tool to capture performance statistics around a docker logs match.
## Invoke the script and wait for the issue to occur, the script will stop
## on it's own when $match is seen in the $container_name log file.
@squizzi
squizzi / api-spec.js
Created June 11, 2018 22:06
Replace tests/api-spec.js with this file
var request = require('request');
var base_url = "http://api:8080/";
describe("When testing 'api/pet'", function(){
it("should respond with the URL of a cat GIF", function(done) {
request(base_url + 'api/pet', function(error, response, body){
expect(body).toMatch(/\{"imageId":\d+,"url":"http(s?):/);
done();
});
});
@squizzi
squizzi / populate-dtr.sh
Last active October 26, 2022 22:42
Populate an MSR (Mirantis Secure Registry) for testing.
#!/bin/sh
# Available on hub: docker pull squizzi/populate-dtr:latest
# Script to quickly and easily populate a DTR test environment with some images and tags
# Usage/help text
usage_text () {
echo -e "Usage: docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock squizzi/populate-dtr -H <hostname>:<port> -u <username> -p <password>"
exit 1
}