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
# @see https://wiki.apache.org/httpd/RewriteHTTPToHTTPS | |
RewriteEngine On | |
RewriteCond %{HTTPS} !=on | |
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L] |
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 | |
# Secure the contents of the given directory recursively. | |
# @see http://wiki.dreamhost.com/Security#Setting_file_permissions | |
if [ -d $1 ]; then | |
find $1 -type f ! -perm +a=x -exec chmod 644 {} + | |
find $1 -type d -exec chmod 755 {} + | |
find $1 -type f -perm +a=x -exec chmod 755 {} + | |
else | |
echo $0: Argument must be a directory. | |
fi |
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 | |
# @see https://github.com/drduh/OS-X-Yosemite-Security-and-Privacy-Guide#services | |
# @todo Design a better RE. Also, extract the file name from the full path. | |
regex="\"Program\" = \"([^\"]+)\"" | |
for x in `launchctl list | awk '{ if (NR > 1) { print $3 } }' | sort` | |
do | |
[[ `launchctl list ${x}` =~ ${regex} ]] | |
echo ${BASH_REMATCH[1]} # @see `man bash` |
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 | |
# @see http://dx.doi.org/10.1145/2560217.2560219 | |
# @see http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-857-network-and-computer-security-spring-2014/lecture-notes-and-readings/ | |
program=/usr/bin/acpi-listen | |
path=/dev/null # @todo Specify a valid 6676-byte filename. | |
for letter in {a..z} {A..Z} | |
do | |
# Note that `gtimeout` is the Homebrew-installed version of `timeout`, a GNU core utility. |
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
# @see http://stackoverflow.com/a/18986500 | |
require 'securerandom' | |
def StripeKey() | |
prefix = 'sk_live_' | |
# @see http://ruby-doc.org/stdlib-1.9.3/libdoc/securerandom/rdoc/SecureRandom.html#method-c-urlsafe_base64 | |
key = SecureRandom.urlsafe_base64(24) | |
# Keep generating keys until a hyphen- and underscore-free one is found. |
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
# @see https://www.recurse.com/apply | |
# My off-the-cuff solution. Sub-optimal, in all likelihood. I would prefer to test divisibility using base-10-digit-based tricks, but that'd make the code less readable. | |
def CracklePop(start, end): | |
for n in range(start, end + 1): # Mind the fencepost. | |
divisibleBy3 = divisibleBy(n, 3) | |
divisibleBy5 = divisibleBy(n, 5) | |
if divisibleBy3 and divisibleBy5: |
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
say "Fitter." using "Fred" | |
say "Happier." using "Fred" | |
say "More productive." using "Fred" | |
say "Comfortable." using "Fred" | |
say "Not drinking too much." using "Fred" |
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
# Block websites (e.g., Facebook) using `/etc/hosts`. | |
for x in facebook; do | |
sudo sed -i '' -e "/${x}/ s/^#//" /etc/hosts | |
done | |
# use `top` to view `httpd` processes | |
# See <http://stackoverflow.com/questions/8710584/filter-by-process-name-and-log-cpu-usage#8710740>. | |
top -p `pgrep -d',' httpd` | |
# delete an Open edX user on Bitnami |
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 | |
# @see http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html | |
#sudo groupadd www | |
#sudo usermod -a -G www ec2-user | |
sudo chown -R root:www /var/www | |
sudo chmod 2775 /var/www | |
find /var/www -type d -exec sudo chmod 2775 {} + | |
find /var/www -type f -exec sudo chmod 0664 {} + |
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
<!-- (Inspired by <http://legacy.rideuta.com/ridingUTA/payingFare/freeFareZone.aspx>.) --> | |
<?xml version="1.0" encoding="UTF-8" ?> | |
<kml xmlns="http://www.opengis.net/kml/2.2"> | |
<Placemark> | |
<name>UTA Free Fare Zone</name> | |
<Polygon> | |
<outerBoundaryIs> | |
<LinearRing> | |
<coordinates> | |
-111.88509,40.75826 <!-- 200 E. & 500 S. --> |
NewerOlder