Skip to content

Instantly share code, notes, and snippets.

View ph-One's full-sized avatar

Kyle A. Matheny ph-One

View GitHub Profile
@ph-One
ph-One / checkServers.sh
Last active December 22, 2015 18:39
A shell script example of how to check if your servers are up (the quick 'n dirty way.) Provided an example of how to check both an HTTP server, and an FTP server.Use `crontab` to automate this scripts execution.
#!/bin/bash
# Setup a cron job to check on your servers every 5 minutes. #
# #
# crontab -e #
# */5 * * * * /path/to/checkServers.sh #
# #
@ph-One
ph-One / mountEnc.sh
Last active December 22, 2015 18:48
How to mount a second HDD that is Luks encrypted
#!/bin/bash
cryptsetup luksOpen /dev/sdb external
mount /dev/mapper/external /external
@ph-One
ph-One / HTML.sublime-snippet
Last active December 22, 2015 18:49
A quick HTML structure for prototyping.
<!--
A useful keyboard shortcut. Below is an example of ctrl+`+1
{ "keys": ["ctrl+`", "ctrl+1"], "command": "insert_snippet", "args": {"name": "Packages/User/HTML.sublime-snippet"} }
-->
<snippet>
<content><![CDATA[
<!DOCTYPE html>
<!--[if lt IE 7]> <html lang="en-US" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html lang="en-US" class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html lang="en-US" class="no-js lt-ie9"> <![endif]-->
@ph-One
ph-One / PHP_List_PDO_Drivers.php
Last active August 29, 2015 14:06
PHP_List_PDO_Drivers
<?php
foreach(PDO::getAvailableDrivers() as $driver) {
echo "$driver, ";
}
// EOF
@ph-One
ph-One / git-conflict-alias
Created September 23, 2014 23:33
Git Conflicts Alias
git config --global alias.conflicts "diff --name-only --diff-filter=U"
@ph-One
ph-One / gist:576b4f02e1e0c59b7ea3
Created November 8, 2014 01:26
Split simple Object into key and value Arrays
// Separate Object into key and value arrays
var obj = {'a': 7, 'b': 8, 'c': 9};
var k = Object.keys(obj); // [a, b, c]
var v = k.map(function(k, i) { return obj[k]; }); // [7, 8, 9]
@ph-One
ph-One / xhr.js
Last active August 29, 2015 14:12
XHR
// Mozilla
function reqListener () {
console.log(this.responseText);
}
var oReq = new XMLHttpRequest();
oReq.onload = reqListener;
oReq.open('get', 'yourFile.txt', true);
oReq.send();
@ph-One
ph-One / .config
Created March 3, 2016 20:04
Kernel 3.18.26 Docker Config
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86 3.18.26-docker Kernel Configuration
#
CONFIG_64BIT=y
CONFIG_X86_64=y
CONFIG_X86=y
CONFIG_INSTRUCTION_DECODER=y
CONFIG_PERF_EVENTS_INTEL_UNCORE=y
CONFIG_OUTPUT_FORMAT="elf64-x86-64"

SHell Time Savers

Note: spaces and casing matter, always!

Unless otherwise stated, all commands are executed against a GNU/Linux OS.

History

Re-run the last command

@ph-One
ph-One / keybase.md
Created August 15, 2017 23:21
keybase.md

Keybase proof

I hereby claim:

  • I am ph-one on github.
  • I am kylem (https://keybase.io/kylem) on keybase.
  • I have a public key ASAWLUNbvWn8nuIfV2Lb1ApwPaYVw8SlWJNIvToULjJPUAo

To claim this, I am signing this object: