Skip to content

Instantly share code, notes, and snippets.

View patrickserrano's full-sized avatar
🔉

Patrick Serrano patrickserrano

🔉
View GitHub Profile
#!/bin/sh
f="$(dirname $0)/log.txt"
if [ "$1" = "time" ]; then
last="$(cat "$f" | grep "# " | tail -n 1 | sed 's/^.*: //' | cut -d '-' -f 1)"
last=$(date +%s -d "$last")
now=$(date +%s)
diff=$(($now - $last))
@grenade
grenade / robocopy.ps1
Last active March 12, 2024 15:22
Wrap robocopy in powershell to get standard (0/1) exit codes.
<#
.Synopsis
Robocopy wrapper with standard 0 (success) and 1 (failure) exit codes.
.Parameter source
Defines the source folder
.Parameter target
Defines the target folder
.Parameter include
Defines the files to include. Accepts wildcards. Eg: -include *.dll,*.pdb
Optional, Default value is $null and will include all files from source.
@jed
jed / how-to-set-up-stress-free-ssl-on-os-x.md
Last active August 30, 2024 08:37
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying