Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!
openssl genrsa -des3 -out rootCA.key 4096
This guide is for installing redis as a replacement for the memcached php session store when using php71u IUS packages on a CentOS-6 environment.
<?php | |
/** | |
* Find the starting Monday for the given week (or for the current week if no date is passed) | |
* | |
* This is required as strtotime considers Sunday the first day of a week, | |
* making strtotime('Monday this week') on a Sunday return the adjacent Monday | |
* instead of the previous one. | |
* | |
* @param string|\DateTime|null $date |
inotifywait -m ~/public_html -e create -e moved_to -e modify | | |
while read directory action file; do | |
if [[ "$file" =~ .*php$ ]] || [[ "$file" =~ .*htaccess$ ]]; then | |
echo "File $file was $action" >> ~/watch.log | |
~/watchit.sh | |
fi | |
done |
# | |
# Monitor file $1 for changes | |
# Send an alert emai to $2 if file $1 changes | |
# usage: inotify_email_watcher.sh /var/log/messages [email protected] | |
if [ -z "$2" ]; then | |
echo "Usage: inotify_email_watcher.sh" | |
exit 1 | |
fi | |
# if the file exists | |
if [ -f $1 ] || [ -d $1 ]; then |
#/bin/sh | |
# Usage instructions: sh find.sh php|tr '\n' '; ' | |
# Then copy and paste the output and execute it | |
ext=$1 | |
C="\u200E \u200F \u202A \u202B \u202C \u202D \u202E \u2066 \u2067 \u2068 \u2069 \u202C" | |
for a in $C; do echo find . -type f -name \"*.$ext\" -exec grep -H \$\'$a\' {} \\\; ; done |
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
location / { | |
return 301 https://www.domain.com$request_uri; | |
} | |
} | |
server { | |
listen 443 ssl http2; |
# Get-EvengLog doesn't quite work I guess: | |
# https://stackoverflow.com/questions/31396903/get-eventlog-valid-message-missing-for-some-event-log-sources# | |
# Get-EventLog Application -EntryType Error -Source "DistributedCOM" | |
# The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID | |
#$logs = Get-EventLog -LogName "System" -EntryType Error -Source "DCOM" -Newest 1 -Message "The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID*" | |
# 2 is error | |
# 3 is warning | |
$EVT_MSG = "The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID" | |
# Search for System event log ERROR entries starting with the specified EVT_MSG | |
$logEntry = Get-WinEvent -FilterHashTable @{LogName='System'; Level=2} | Where-Object { $_.Message -like "$EVT_MSG*" } | Select-Object -First 1 |
When I learned of regular expression engines that support recursion I thought I could write a recursive-descent parser in regex. Since I've written JSON parsers a few times and it's a simple spec, I chose that as the test case. In the end I created two versions.
As a PHP developer on Ubuntu, we may need to re setup our development environment sometimes. I did it already a few times, so decided to write down the steps for a typical php development environment on ubuntu. My Ubuntu version is 16.04.