Skip to content

Instantly share code, notes, and snippets.

@JacobWeisenburger
JacobWeisenburger / makeSearchParamsObjectSchema.ts
Last active June 8, 2024 16:44
a way to parse URLSearchParams with Zod
import { z } from 'zod'
function safeParseJSON ( string: string ): any {
try { return JSON.parse( string ) }
catch { return string }
}
function searchParamsToValues ( searchParams: URLSearchParams ): Record<string, any> {
return Array.from( searchParams.keys() ).reduce( ( record, key ) => {
const values = searchParams.getAll( key ).map( safeParseJSON )

#Fixing “WARNING: UNPROTECTED PRIVATE KEY FILE!” on Linux

If you are getting this error then you probably reset the permissions on your hidden .ssh directory in your user folder, and your keys aren’t going to work anymore. It’s very important that these files not be writable by just anybody with a login to the box, so openssh will give you an error if you try to use them.

The full error message:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@jimothyGator
jimothyGator / README.md
Last active April 25, 2024 18:00
Nginx configuration for Mac OS X with Homebrew, using sites-enabled directory.
mkdir -p /usr/local/etc/nginx/sites-{enabled,available}
cd /usr/local/etc/nginx/sites-enabled
ln -s ../sites-available/default.conf
ln -s ../sites-available/default-ssl.conf

File locations:

  • nginx.conf to /usr/local/etc/nginx/
  • default.conf and default-ssl.conf to /usr/local/etc/nginx/sites-available
  • homebrew.mxcl.nginx.plist to /Library/LaunchDaemons/