Daryl Tucker
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
import datetime | |
import calendar | |
import time | |
def objectid_to_epoch(_id) | |
epoch = datetime.datetime.fromtimestamp(int(str(_id)[0:8], 16)) | |
return calendar.timegm(datetime.datetime(epoch.year, epoch.month, epoch.day, epoch.hour, epoch.minute).utctimetuple()) |
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
import pprint | |
def pp(data, ro=False): | |
"""Format for pretty print.""" | |
if not ro: | |
pprint.pprint(data, indent=4, width=10) | |
return pprint.pformat(data, indent=4, width=10) |
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
server{ | |
server_name domain.tld; | |
rewrite ^ https://domain.tld$request_uri? permanent; | |
} | |
server{ | |
ssi on; | |
listen 443; | |
server_name domain.tld; |
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 | |
# @daryltucker | |
# This will download files within a specific directory but preserve media. For example: | |
# www.domain.tld/subdirectory/ | |
# index.html | |
# page1.html (contains an image on www.domain.tld/images) | |
# page2.html (contains an image on www.domain.tld/) | |
wget -p -r -l1 --no-parent "$@" |
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
setInterval(function(){ | |
var x = document.getElementsByTagName('a'); | |
console.log(x); | |
for ( var i=0; i<x.length; i++) { | |
x[i].click(); | |
}; | |
}, 500); |
cp -vi /boot/config-`uname -r` .config
Use the following if you wish to only build modules for devices currently in use/connected. For example, if you don't have any usb_storage devices, you won't be able to plug in usb drives.
make localmodconfig
make -j6
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
import tarfile | |
import glob | |
import tempfile | |
FILENAME = 'Title_for_your_file' | |
t_dir = t_dir = tempfile.mkdtemp(prefix='app-') | |
# Compress t_dir | |
tarname = '/tmp/%s.tar.bz2' % (FILENAME) | |
fileobj = open(tarname, 'wb') |
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 | |
pwd=`pwd` | |
git_directory='/home/daryl/Projects/*' | |
for d in $git_directory; | |
do | |
echo $d | |
cd $d | |
git fetch --all | |
git pull --all | |
done |
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
import urlparse | |
def url_norm(url, scheme='http'): | |
response = 0 | |
try: | |
x = urlparse.urlsplit(url, scheme=scheme) | |
response = '%s://%s%s' % (x.scheme, x.netloc, x.path) | |
except Exception: | |
pass |
OlderNewer