This file contains hidden or 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 | |
$publicKey = "file://Users/dgiglio/.ssh/mykey.pem"; | |
$plaintext = "String to encrypt"; | |
openssl_public_encrypt($plaintext, $encrypted, $publicKey); | |
echo $encrypted; //encrypted string |
This file contains hidden or 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 | |
require 'common.php'; | |
// base dateframes | |
$dateframe = new DateFrame('1960-01-01', '1974-04-01'); | |
$dateframes = $dateframe->asMonthIntervals(1); | |
$dateframes = array_reverse($dateframes); | |
This file contains hidden or 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
cat windows-EOL.txt | tr '\r' '\n' |
This file contains hidden or 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/env bash | |
tail -n 1000 /var/log/my.log | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" |
This file contains hidden or 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 | |
find /path/to/files -type f -exec sed -i "" 's/oldtext/newtext/g' {} \; # find/repalce inside files | |
find /path/to/files -type f -name "*" -exec sh -c 'mv "$0" "${0/oldfilenametext/newfilenametext}"' '{}' \; # find and replace in filenames |
This file contains hidden or 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 | |
set_include_path ('/home'); | |
require 'vendor/autoload.php'; | |
\Slim\Slim::registerAutoloader(); | |
const DATALOC = "/home/data"; | |
$allowed_objects = ['tests']; | |
$app = new \Slim\Slim(); |
This file contains hidden or 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 | |
$cacheDir = "cache"; | |
$cacheFile = $cacheDir."/data-cache-".md5($_SERVER['QUERY_STRING']).".json"; | |
$generFile = "data-generate.php"; | |
if(!is_writable($cacheDir)){ | |
header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error', true, 500); | |
} |
This file contains hidden or 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/bah | |
/usr/sbin/screencapture -t jpg -x ~/Desktop/screenshots/$(date +%Y\-%m\-%d\_%H.%M.%S).jpg; | |
find ~/Desktop/screenshots/ -type f -name '*.jpg' -mtime +14 -exec rm {} \; |
This file contains hidden or 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
/** | |
* Get points between two points on simple grid. Points must be in a straight line. | |
* Results will include start and end points | |
* | |
* @param A array x, y coordinates of one point | |
* @param B array x, y coordinates of second point | |
* @return false if points are not in a straight line or if points are the same else | |
* array of arrays of x, y coordinates between the two points. | |
* | |
* fixed so that coordinates can be in any direction from each other. |
This file contains hidden or 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
grep -nr '#[a-fA-F0-9]\{3,6\}' . |