Skip to content

Instantly share code, notes, and snippets.

View dmgig's full-sized avatar
🏠

Dave M. Giglio dmgig

🏠
View GitHub Profile
@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 / 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 / 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 / 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 / factory-customer.js
Last active March 25, 2016 18:31
Sample Angular Factory
/**
* https://medium.com/opinionated-angularjs/angular-model-objects-with-javascript-classes-2e6a067c73bc
*/
.factory('Customer', function ($http, $log, KeyMap) {
var Customer = function(OtherCustomer){
this.id = OtherCustomer.id;
this.keymap = KeyMap;
this.comparisons = [];
this.working = false;
@dmgig
dmgig / dg-config-setter-input.html
Last active March 29, 2016 16:43
Sample Config Settings AngularJS App
<div>
<div ng-switch="controller.field_type">
<!-- bool -->
<div ng-switch-when="bool">
<button class="btn btn-default btn-block"
ng-class="controller.config_value ? 'btn-info' : 'btn-warning'"
ng-model="controller.config_value"
ng-click="updateBool()">
@dmgig
dmgig / curlToGet.html
Created March 30, 2016 18:59
Reverse a cURL call to a URL with GET params
url: <b id="output"></b>
<script type="text/javascript">
var curlToGet = function(curl){
var url, data;
var getParams = function(e, i, arr){
flag = this;
@dmgig
dmgig / index.php
Created April 3, 2016 19:36
Obscenely Simple PHP File Upload
<?php
define("UPLOAD_DIR", "./");
ini_set("upload_max_filesize", "200M");
ini_set("post_max_size", "200M");
if (!empty($_FILES["myFile"])) {
$myFile = $_FILES["myFile"];
if ($myFile["error"] !== UPLOAD_ERR_OK) {
echo "<p>An error occurred.</p>";
@dmgig
dmgig / phplint.sh
Last active April 4, 2016 16:03 — forked from mathiasverraes/phplint.sh
Recursive PHP Lint script (git tracked files only)
#!/bin/bash
# php linter of git tracked files
# passing --success argument will print no-error files in the list,
# otherwise, only files with parse errors will be displayed.
IFS=$'\n' #split filenames at newlines only
for file in `git ls-tree -r master --name-only`
do
@dmgig
dmgig / AudioContext.html
Created April 20, 2016 18:46
Messy messing with the browser's AudioContext capabilities...
<script type="application/javascript">
// create web audio api context
var audioCtx = new (window.AudioContext || window.webkitAudioContext)();
// create Oscillator and gain node
// connect oscillator to gain node to speakers