Skip to content

Instantly share code, notes, and snippets.

View PeterGrace's full-sized avatar

Peter Grace PeterGrace

  • Pottstown, PA
  • 03:43 (UTC -05:00)
View GitHub Profile
@PeterGrace
PeterGrace / parse-slow-log.sh
Created June 21, 2018 17:18 — forked from JCotton1123/parse-slow-log.sh
Parse php-fpm slow log
## Slow requests grouped by function call
cat /var/log/php-fpm/www-slow.log | grep -A 1 script_filename | \
grep -v script_filename | grep -v -e "--" | cut -c 22- | sort | uniq -c | sort -nr
## Slow requests grouped by minute
cat /var/log/php-fpm/www-slow.log | grep 'pool www' | \
cut -d' ' -f2 | sort | cut -d: -f1,2 | uniq -c
## Top 25 1 minute groups of slow requests
cat /var/log/php-fpm/www-slow.log | grep 'pool www' | cut -d' ' -f2 | \
@PeterGrace
PeterGrace / aws-creds.bash
Created June 21, 2018 16:02 — forked from ddgenome/aws-creds.bash
Fetch AWS STS keys and set environment variables
#!/bin/bash
# Fetch 24-hour AWS STS session token and set appropriate environment variables.
# See http://docs.aws.amazon.com/cli/latest/reference/sts/get-session-token.html .
# You must have jq installed and in your PATH https://stedolan.github.io/jq/ .
# Add this function to your .bashrc or save it to a file and source that file from .bashrc .
# https://gist.github.com/ddgenome/f13f15dd01fb88538dd6fac8c7e73f8c
#
# usage: aws-creds MFA_TOKEN [OTHER_AWS_STS_GET-SESSION-TOKEN_OPTIONS...]
function aws-creds () {
local pkg=aws-creds
@PeterGrace
PeterGrace / Configuration.h
Created November 8, 2017 01:15
Configuration.h for CR-10 with 1.1.6
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* 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 3 of the License, or
@PeterGrace
PeterGrace / hb_all_books_dl.js
Created August 30, 2017 21:01 — forked from kfatehi/hb_all_books_dl.js
Humble bundle book bundles - download all books at once
/*
After purchasing a humble book bundle, go to your download page for that bundle.
Open a console window for the page and paste in the below javascript
this fork downloads all formats and does so without using jquery (since that didnt work for me)
note that if you are in chrome, chrome will not download the pdfs for you by default, to fix this
type “about:plugins” in the address bar and disable chrome's pdf viewer
*/
var pattern = /(MOBI|EPUB|PDF)$/i;
[INFO ] [GL ] NPOT texture support is available
[INFO ] [OSC ] using <multiprocessing> for socket
[INFO ] [ProbeSysfs ] device match: /dev/input/event0
[INFO ] [HIDInput ] Read event from </dev/input/event0>
[INFO ] [Base ] Start application main loop
[INFO ] [HIDMotionEvent] using <FT5406 memory based driver>
[INFO ] [HIDMotionEvent] <FT5406 memory based driver> range ABS X position is 0 - 800
[INFO ] [HIDMotionEvent] <FT5406 memory based driver> range ABS Y position is 0 - 480
[INFO ] [HIDMotionEvent] <FT5406 memory based driver> range position X is 0 - 800
[INFO ] [HIDMotionEvent] <FT5406 memory based driver> range position Y is 0 - 480
@PeterGrace
PeterGrace / .tmux.conf
Created March 27, 2015 13:16
pete's tmux config
# Clear the two common binds for prefix to "clean the slate"
unbind C-a
unbind C-b
#I need this in cygwin to make mouse mode work properly, might not be needed for others
set -sg escape-time 250
#make the command prefix control+a
set -g prefix C-a
### Keybase proof
I hereby claim:
* I am PeterGrace on github.
* I am petergrace (https://keybase.io/petergrace) on keybase.
* I have a public key whose fingerprint is 4BD3 38C5 306A A1B1 54F9 757F 94B3 C1E1 BAFD 725B
To claim this, I am signing this object: