Skip to content

Instantly share code, notes, and snippets.

View ibejohn818's full-sized avatar

John Hardy ibejohn818

  • GoDaddy Inc
  • Los Angeles, Ca
View GitHub Profile
@ibejohn818
ibejohn818 / .backupignore
Last active August 29, 2015 14:14
rsync mac script
.HFS+\ Private\ Directory\ Data
/.journal
/.journal_info_block
.AppleDouble
/lost+found
.metadata_never_index
.com.apple.timemachine.donotpresent
.VolumeIcon.icns
/TheVolumeSettingsFolder
Saved\ Application\ State
@ibejohn818
ibejohn818 / aws-dynamic-dns
Last active August 29, 2015 14:17
Route53 Dynamic DNS
#!/usr/bin/env php
<?php
$template = [
"Comment"=>"",
"Changes"=>[
["Action"=>"#action#",
"ResourceRecordSet"=>[
"ResourceRecords"=>[
@ibejohn818
ibejohn818 / gist:6cb033cc540c99b64828
Created April 1, 2015 05:17
CodeMirror HTML with Folding
<?php
echo $this->Html->script([
"//rawgit.com/codemirror/CodeMirror/master/lib/codemirror.js",
"//rawgit.com/codemirror/CodeMirror/master/addon/hint/show-hint.js",
"//rawgit.com/codemirror/CodeMirror/master/addon/hint/xml-hint.js",
"//rawgit.com/codemirror/CodeMirror/master/addon/hint/html-hint.js",
"//rawgit.com/codemirror/CodeMirror/master/mode/xml/xml.js",
"//rawgit.com/codemirror/CodeMirror/master/mode/javascript/javascript.js",
"//rawgit.com/codemirror/CodeMirror/master/mode/css/css.js",
"//rawgit.com/codemirror/CodeMirror/master/mode/htmlmixed/htmlmixed.js",
@ibejohn818
ibejohn818 / gist:507fade3aa2b7f4dc218
Created April 5, 2015 17:28
Linux NAT'ing Steps
On NAT Host
1) enable IPv4 fowarding
/etc/sysctl.conf
2) Forward eth0 -> eth1 and vise-versa
-A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i eth1 -o eth0 -j ACCEPT
3) modify nat table to masquerade ( Rewrite ip packets )
@ibejohn818
ibejohn818 / gist:f1e9a663f84ba7f5912e
Created August 5, 2015 21:17
bash: show memory usage
free -m | awk 'NR==2{printf "Memory Usage: %s/%sMB (%.2f%)\n", $3,$2,$3*100/$2 }'
@ibejohn818
ibejohn818 / gist:cba37c90af8c0302716c
Last active August 29, 2015 14:28
Dynamic SQL Pivot
SET @sql = NULL;
SELECT
GROUP_CONCAT(
CONCAT(
'MAX(IF(cf.name =''',
name,
''',cv.field_value,NULL)) AS ',
'`',
name,
@ibejohn818
ibejohn818 / gist:3978c42a4dc594bfe8ba9c8fddb32e06
Last active April 7, 2016 23:09
Angular aborting requests
'use strict';
angular.module('testServices',[])
.service('test',[
'$http','$q',
function($http,$q) {
var testing = function(ag) {
console.log(ag);
Another File to test
tmux set-option -ga terminal-overrides ",xterm-256color:Tc"
@ibejohn818
ibejohn818 / gist:227be59e8b19fdb722271270058a4704
Last active June 13, 2016 23:57
Get Pagination position of single record
-- GET THE RANK BASED ON BASE CONDITIONS AND BASE SORT AND DIVIDE BY THE LIMIT ROUNDED UP TO GET PAGE NUMBER
select x.rank
from (
SELECT
`PortalBdReportPosTransactionSummary`.id,
@rownum := @rownum+1 AS rank
FROM
portal_bd_report_pos_transaction_summaries AS `PortalBdReportPosTransactionSummary`, (select @rownum := 0) r
WHERE
`PortalBdReportPosTransactionSummary`.`dvrdatetime` >= '2016-06-09 00:00:00'