Skip to content

Instantly share code, notes, and snippets.

View lawipac's full-sized avatar
❤️
Happy Developing

Patrick Peng Sun lawipac

❤️
Happy Developing
View GitHub Profile
@lawipac
lawipac / push ssl to cpanel and restart nginx.php
Created April 28, 2019 01:58
Update Cpanel certificate from external server
#!/usr/bin/php
#put under /etc/letsencrypt/renewal-hooks/deploy
<?php
//
//read environment variables
//the shell variable $RENEWED_LINEAGE will point to the config live subdirectory
//(for example, "/etc/letsencrypt/live/example.com") containing the new certs and
//keys; the shell variable $RENEWED_DOMAINS will contain a space-delimited list
//of renewed cert domains (for example, "example.com www.example.com").
@lawipac
lawipac / file-upload-multipart.go
Created April 2, 2021 14:10 — forked from andrewmilson/file-upload-multipart.go
Golang multipart/form-data File Upload
package main
import (
"net/http"
"os"
"bytes"
"path"
"path/filepath"
"mime/multipart"
"io"
@lawipac
lawipac / FileServerWith404.go
Created August 7, 2021 10:11 — forked from lummie/FileServerWith404.go
A wrapper for GOs http.FileServer that allows a custom 404 handler to be assigned
package middleware
import (
"net/http"
"os"
"path"
"strings"
)
// FSHandler404 provides the function signature for passing to the FileServerWith404