Skip to content

Instantly share code, notes, and snippets.

View dmgig's full-sized avatar
🔥

Dave M. Giglio dmgig

🔥
View GitHub Profile
@dmgig
dmgig / url-monitor.html
Last active March 25, 2016 18:15
Sample AngularJS Page with Services to Monitor URL Responses and Update UI
<html>
<head>
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
<script src="node_modules/jquery/dist/jquery.min.js"></script>
<script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.2/angular.js"></script>
</head>
<body>
<div class="container" ng-app="DataValidationApp">
@dmgig
dmgig / show_log_dates.sh
Created March 22, 2016 20:21
Show First Line of Compressed Logs
#!/bin/bash
LOGPATH='/var/log/apache2'
FILES="$(ls -1 ${LOGPATH}/access_log* )"
for FILE in $FILES
do
echo $FILE
if [ ${FILE: -3} == ".gz" ]
then
@dmgig
dmgig / awk-gt.sh
Created March 22, 2016 17:44
awk show greater than
cat my.log | grep "completion time:" | awk '{ if($8 > 10) print $8 }'
@dmgig
dmgig / keybase.md
Created March 17, 2016 21:03
keybase prove github

Keybase proof

I hereby claim:

  • I am dmgig on github.
  • I am dmgg (https://keybase.io/dmgg) on keybase.
  • I have a public key ASDVdQUy1w4fQ4GKUG5DnC8QS4ZIUD404XDZ7hy0VzMWJwo

To claim this, I am signing this object:

@dmgig
dmgig / matrix_math.html
Created February 18, 2016 21:26
Matrix Math QUnit Tests
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>QUnit Matrix Tests</title>
<link rel="stylesheet" href="//code.jquery.com/qunit/qunit-1.19.0.css">
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
@dmgig
dmgig / table_tab_import.sh
Last active February 11, 2016 21:56
MySQL: Import tables & data from sql and tab delimited dumps
#! /bin/bash
# Note: This script disables foreign key checks and ignores all errors!
DUMPDIR='/tmp/mysql_dumps/'
USERNAME='root'
PASSWORD='MyP@55'
DATABASE='databaseName'
@dmgig
dmgig / autosave-form.js
Last active August 29, 2015 14:14
Auto-saving Form (jQuery required)
/**
* editBox
* auto-updating form, with reset/resave
* @author D.M. Giglio
*/
(function(window, document, $){
'use strict';
$(document).ready(function(){
@dmgig
dmgig / mysql-momentary-general-log.sql
Last active August 29, 2015 14:14
mysql: momentarily enable general log file / table
# mysql: momentarily enable, then view, general log table
SET GLOBAL log_output = 'TABLE';
SET GLOBAL general_log = 'ON';
SELECT SLEEP(5);
SET GLOBAL general_log = 'OFF';
SELECT * FROM mysql.general_log;
######
@dmgig
dmgig / pt-table-checksum-sample
Created January 15, 2015 15:26
Percona pt-table-checksum samples
# whole table check
pt-table-checksum --databases=world --tables=city --user=root --ask-pass --no-check-binlog-format
# with a parameter for smaller samples
pt-table-checksum --databases=world --tables=city --where="name LIKE '%a%'" --user=root --ask-pass --no-check-binlog-format
@dmgig
dmgig / pt-heartbeat
Created January 14, 2015 20:48
Percona pt-heartbeat sample
PTDEBUG=1 pt-heartbeat --host="mysql-b" --user=root --ask-pass --database="percona" --monitor --master-server-id="14" --frames=1m,5m,15m,1h,12h,1d