Skip to content

Instantly share code, notes, and snippets.

@zwf
zwf / letsencrypt_notes.sh
Created June 16, 2022 13:20 — forked from lachesis/letsencrypt_notes.sh
Set up LetsEncrypt using acme.sh without root
# How to use "acme.sh" to set up Lets Encrypt without root permissions
# See https://github.com/Neilpang/acme.sh for more
# This assumes that your website has a webroot at "/var/www/<domain>"
# I'll use the domain "EXAMPLE.com" as an example
# When this is done, there will be an "acme" user that handles issuing,
# updating, and installing certificates. This account will have the following
# (fairly minimal) permissions:
# - Host files at http://EXAMPLE.com/.well-known/acme-challenge
@zwf
zwf / postgresql_jsonb_crud.sql
Created December 5, 2018 01:31 — forked from inindev/postgresql_jsonb_crud.sql
Simple PostgreSQL 9.4 functions to manipulate jsonb objects adapted from Matheus de Oliveira's json_manipulator.sql. https://gist.github.com/matheusoliveira/9488951 (Note: performance is not a concern for those functions)
/*
* derivative work of Matheus de Oliveira's json_manipulator.sql
* https://gist.github.com/matheusoliveira/9488951
*
* adapted to support postgresql 9.4 jsonb type
* no warranties or guarantees of any kind are implied or offered
*
* license is as Matheus conferred it on 4/9/2015:
* matheusoliveira commented on Apr 9
* @hannes-landeholm, I'd like to take credit if you share them
@zwf
zwf / README.md
Created September 5, 2018 04:39 — forked from jesslilly/README.md
Deluxe Cron Job Wrapper

Cron Job Wrapper Wish List

I want a script that will give me:

  1. Logging
  2. Log purging!
  3. Email errors!
  4. Prevent duplicate processes! (flock)
  5. Source an environment file!
  6. Anything else?

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@zwf
zwf / nomad_server.sh
Created July 30, 2018 09:34 — forked from pengchujin/nomad_server.sh
nomad_server
#!/bin/bash
# server install
export IP_ADDRESS=$(hostname -i)
echo $IP_ADDRESS
apt-get update
apt-get install -y unzip dnsmasq wget
# install Nomad
wget https://releases.hashicorp.com/nomad/0.8.4/nomad_0.8.4_linux_amd64.zip
unzip nomad_0.8.4_linux_amd64.zip -d /usr/local/bin/
var CryptoJS = require('crypto-js')
var request = require('request-promise')
/*
* npm install crypto-js request-promise request
* node wx_t1t_hack.js
*/
// export function testEncription(msg, fullKey) {
// var fullKey = fullKey.slice(0, 16)
@zwf
zwf / resizeImageAndCentering.vbs
Last active November 15, 2017 08:45
resize images in word docs and horizontal center by word macro
Sub ResizeAllImagesAndHorizontalCenter()
Dim oShp As Shape
Dim oILShp As InlineShape
For Each oILShp In ActiveDocument.InlineShapes
With oILShp
.ConvertToShape
End With
Next
@zwf
zwf / install-docker-elementary-loki.sh
Created August 2, 2017 15:59 — forked from ChrisTimperley/install-docker-elementary-loki.sh
Installs Docker on Elementary OS 0.4 (Loki)
#!/bin/bash
sudo apt-get install apt-transport-https ca-certificates -y
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo rm -f /etc/apt/sources.list.d/docker.list
echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | tee /etc/apt/sources.list.d/docker.list
sudo apt-get update
sudo apt-get purge lxc-docker
sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual
sudo apt-get install docker-engine
@zwf
zwf / fix-homebrew-npm.md
Created March 24, 2017 16:53 — forked from DanHerbert/fix-homebrew-npm.md
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

Solution

This solution fixes the error caused by trying to run npm update npm -g. Once you're finished, you also won't need to use sudo to install npm modules globally.

Before you start, make a note of any globally installed npm packages. These instructions will have you remove all of those packages. After you're finished you'll need to re-install them.

@zwf
zwf / gist.md
Created August 24, 2016 15:26 — forked from bumaociyuan/gist.md
Stuck on `Authenticating with the App Store...`