Skip to content

Instantly share code, notes, and snippets.

View PHLAK's full-sized avatar
Coffee... always coffee...

Chris Kankiewicz PHLAK

Coffee... always coffee...
View GitHub Profile
@PHLAK
PHLAK / build.json
Created November 13, 2014 21:12
Packer QEMU / KVM example.
{
"variables": {
"ssh_user": "root",
"ssh_pass": "T@c0_Bu3n0"
},
"builders": [
{
@PHLAK
PHLAK / openstack-tools-installer.sh
Last active August 29, 2015 14:05
Quick script for installing OpenStack python clients.
#!/usr/bin/env bash
## Require root privileges
if [[ "$(whoami)" != "root" ]]; then
echo "ERROR: You must be root to run this script"
exit 1
fi
## Install python-pip if missing
if [[ ! $(dpkg -l python-pip) ]]; then
import os
import time
path = "U:\\Downloads"
now = int(time.time())
dirList = os.listdir(path)
for fileName in dirList:
filePath = path + "\\" + fileName
@PHLAK
PHLAK / keybase.md
Created March 25, 2014 16:50
keybase.md

Keybase proof

I hereby claim:

  • I am PHLAK on github.
  • I am ChrisKankiewicz (https://keybase.io/ChrisKankiewicz) on keybase.
  • I have a public key whose fingerprint is 7C25 1D83 939B 1898 6DD6 7F0A E008 E594 373D 7E9D

To claim this, I am signing this object:

@PHLAK
PHLAK / ping-test.sh
Created February 11, 2014 18:11
24 hour while loop in bash
#!/bin/bash
## Script start time
START=$(date +%s)
## Total run time
DURRATION=$((60 * 60 * 24))
## Total running time
UPTIME=$(($(date +%s) - $START))
@PHLAK
PHLAK / jquery-cdn-test.sh
Created January 31, 2014 17:25
Test average response times for jQuery from Google and jQuery CDNs
#!/bin/bash
## Set the url
if [[ "$1" == "google" ]]; then
URL="ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"
elif [[ "$1" == "jquery" ]]; then
URL="code.jquery.com/jquery-2.0.3.min.js"
@PHLAK
PHLAK / example.conf
Last active December 25, 2015 19:19
UberGallery Nginx server config example
server {
root /var/www/example;
server_name example.com www.example.com;
location / {
index index.php index.html index.htm;
try_files $uri $uri/ /index.php;
}
@PHLAK
PHLAK / reflectionTesting.php
Created April 24, 2013 23:15
Testing out PHP's reflection functionality.
<?php
function doSomeShit($foo, $bar, $baz) {
// Do some shit...
}
$function = new ReflectionFunction('doSomeShit');
foreach ($function->getParameters() as $parameter) {
@PHLAK
PHLAK / regex.php
Created April 19, 2013 19:37
Regex Testing
<?php
// Read file contents to string
$doc = file_get_contents('secret-doc.txt');
// Run the regex on the string
preg_match_all('/\(?[0-9]{3}\)?[- ]?[0-9]{3}[-\ ]?[0-9]{4}/', $doc, $matches);
// Print out an array of matches
print_r($matches); die();
@PHLAK
PHLAK / Singleton.php
Last active December 16, 2015 08:28
Example PHP singleton class for reference. For the record, singletons are evil: http://stackoverflow.com/a/138012/27025
<?php
/**
* Example PHP singleton class for reference.
* For the record, singletons are evil:
* http://stackoverflow.com/a/138012/27025
*/
class Singleton {
/**