This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function bigformat($n) { | |
// Start with a Googol and work down | |
if($n>pow(10,100)) | |
return round(($n/pow(10,100)),1).' googol'; | |
// I'll add more later | |
if($n>pow(1000,32)) | |
return round(($n/pow(1000,32)),1).' untrigintillion'; | |
if($n>pow(1000,31)) | |
return round(($n/pow(1000,31)),1).' trigintillion'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* turtles.php | |
* | |
* Uses the c.xkcd.com API to get a list of all images within xkcd #1416 Pixels | |
* | |
* @author Alan Hardman <[email protected]> | |
*/ | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if(!empty($_GET["host"])) { | |
$host=$_GET["host"]; | |
if(strpos($host,"/")!==false && ($h=parse_url($host,PHP_URL_HOST))!==false) | |
$host=$h; | |
$host=preg_replace("/(^\-)?[^0-9a-z\.]/i","",$host); | |
$result=shell_exec("ping -nc 1 -W 2000 $host"); | |
preg_match("/(?<=time=)[0-9\.]+/",$result,$m); | |
if(!empty($m[0])) | |
$out=array("online"=>true,"host"=>$host,"ping"=>$m[0]."ms"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
if (empty($argv[1])) { | |
die("Filename parameter is required." . PHP_EOL . "Example: ./ghost2jekyll.php GhostData.json" . PHP_EOL); | |
} | |
@mkdir("_drafts"); | |
@mkdir("_posts"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# http://kedar.nitty-witty.com | |
#SPLIT DUMP FILE INTO INDIVIDUAL TABLE DUMPS | |
# Text color variables | |
txtund=$(tput sgr 0 1) # Underline | |
txtbld=$(tput bold) # Bold | |
txtred=$(tput setaf 1) # Red | |
txtgrn=$(tput setaf 2) # Green | |
txtylw=$(tput setaf 3) # Yellow | |
txtblu=$(tput setaf 4) # Blue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function slugify($str) { | |
return trim(strtolower(preg_replace("/-+/", "-", preg_replace("/[^a-z0-9]/i", "-", $str))), "-"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Collatz Conjecture Test | |
* | |
* This will generate a file showing each step taken to reach 1 following | |
* the Collatz Conjecture with integers between 2 and 2^20. Note that the | |
* resulting file will be over 2 GB, so changing pow(2, 20) to a smaller | |
* number like pow(2, 16) may be preferable. | |
* | |
* @author Alan Hardman <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Sets up a new Ubuntu installation with good things | |
# Desktop and Server are supported | |
# Detect Ubuntu version | |
distro="server" | |
(dpkg -s "ubuntu-desktop" && distro="ubuntu") > /dev/null 2>&1 | |
(dpkg -s "xubuntu-desktop" && distro="xubuntu") > /dev/null 2>&1 | |
(dpkg -s "kubuntu-desktop" && distro="kubuntu") > /dev/null 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am alanaktion on github. | |
* I am alanaktion (https://keybase.io/alanaktion) on keybase. | |
* I have a public key whose fingerprint is F7D8 B00D 7324 35F9 42A9 352E 27A7 9A65 774B 4AF0 | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Bash settings for ultimate happiness | |
# Cross-platform and full of hax | |
# ls aliases | |
alias ls='ls --color' | |
alias ll='ls -alhF' | |
alias la='ls -A' | |
alias l='ls -CF' | |
# Shortcuts |
OlderNewer