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
#find and sort by modified time | |
find . -type f -printf "%T@::%t::%p\n" | sort -n | |
#Grab the last 5 modified files | |
find . -type f -printf "%T@::%t::%p\n" | sort -n | awk -F '::' '{print $3}' | tail -n5 |
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 | |
/** | |
* RedCache : Redis Cacher Interface | |
* @version 2014-10-20 13:16 | |
* @author Steven Hollingsworth <[email protected]> | |
*/ | |
/** Set Constants and default path for all includes */ | |
if(!@include_once("{$_SERVER['PHP_REPORT_BASE_DIR']}/include/_constants.php")) { print "Could not Load standard include file. Bailing...\n<br>"; exit(99); } |
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
find -type f | while read i; do bn=$(basename ${i}); echo ${bn##*.}; done | tr 'A-Z' 'a-z' | sort | uniq |
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
hello_world/ | |
echo "hello world" | |
current_working_directory/ | |
pwd | |
list_files/ | |
ls | |
print_file_contents/ | |
cat access.log | |
last_lines/ | |
tail -n5 access.log |
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
autocmd FileType * exe('let comp_cmd="!~/.vim/bin/build_' . &filetype . '.sh ' . expand("%:p") . '"') | |
autocmd FileType * exe('let run_cmd="!~/.vim/bin/build_' . &filetype . '.sh ' . expand("%:p") . ' \|less -cN"') | |
map z :exec comp_cmd<enter><enter> | |
map R :exec run_cmd<enter><enter> |
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/env bash | |
test_str="1h5m" | |
test_str="5d3h2m50v" #bad | |
test_str="5d3h2m50s" | |
declare -A keys | |
keys[d]=$((60 * 60 * 24)) | |
keys[h]=$((60 * 60)) | |
keys[m]=60 | |
keys[s]=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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import re | |
test_str = "1h5m" | |
test_str = "5d3h2m50s" | |
keys = { | |
'd' : 60 * 60 * 24, | |
'h' : 60 * 60, | |
'm' : 60, |
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/env python | |
# -*- coding: utf-8 -*- | |
import logging | |
import argparse | |
import json | |
import select | |
import sys | |
LOG = logging.getLogger() | |
LOG.setLevel(logging.DEBUG) |
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/env python | |
# -*- coding: utf-8 -*- | |
"""Convert weight in lbs to stats about glucose replacement for your brain.""" | |
# After reading reading "Thinking, Fast and Slow" | |
# by Daniel Kahneman | |
# | |
# Based docs from https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3900881/ | |
# and | |
# https://www.nutritionix.com/food/light-corn-syrup | |
from __future__ import unicode_literals |
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 | |
size_mb="50" | |
dest_file=$(mktemp) | |
mount_dir=$(mktemp -d) | |
dd if=/dev/urandom of=${dest_file} bs=1M count=${size_mb} | |
echo "destfile ${dest_file} crated" | |
lodev=$(losetup --show -f ${dest_file}) | |
echo "loopback ${lodev} created" | |
mkfs.ext4 ${lodev} |
OlderNewer