Skip to content

Instantly share code, notes, and snippets.

@marcoimmel
marcoimmel / ox-wp-crayon.el
Last active January 15, 2018 20:18
org2blog: Wordpress crayon-plugin Backend for Org Export Engine
;;; ox-wp-crayon.el - Wordpress crayon-plugin Backend for Org Export Engine
;;; overrides org-wp-src-block function of org2blog / ox-wp package, https://github.com/punchagan/org2blog
;;; Copyright (C) 2017 [email protected]
;;; Version: 20170110-1
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
@mwpastore
mwpastore / 00README.md
Last active September 30, 2024 16:00
Lightning Fast WordPress: Caddy+Varnish+PHP-FPM

README

This gist assumes you are migrating an existing site for www.example.com — ideally WordPress — to a new server — ideally Ubuntu Server 16.04 LTS — and wish to enable HTTP/2 (backwards compatibile with HTTP/1.1) with always-on HTTPS, caching, compression, and more. Although these instructions are geared towards WordPress, they should be trivially extensible to other PHP frameworks, other FastCGI backends, and even non-FastCGI backends (using proxy in lieu of fastcgi in the terminal Caddyfile stanza).

Quickstart: Use your own naked and canonical domain names instead of example.com and www.example.com and customize the Caddyfile and VCL provided in this gist to your preferences!

These instructions target Varnish Cache 4.1, PHP-FPM 7.0, and Caddy 0.10. (I'm using MariaDB 10.1 as well, but that's not relevant to this guide.)

@doctaphred
doctaphred / shell-script
Last active February 11, 2020 18:59
How to start every shell script, since I can never remember
#!/bin/sh -euvx
# -e If non interactive then exit immediately if a command fails.
# -u Treat unset variables as an error when substituting.
# -v Print shell input lines as they are read.
# -x Print commands and their arguments as they are executed.
#########################################################################
# FreeBSD - a lesson in poor defaults #
# Published on 3/18/2016 #
# Last updated 8/28/2016 #
# https://twitter.com/blakkheim #
#########################################################################
00) Intro
01) OpenSSH Modifications
02) Mailer Daemon
@spacebat
spacebat / function-wrappers.lisp
Created August 27, 2016 23:32
Poor man's defadvice
;; Simple and rough substitute for defadvice :around on SBCL. Should
;; be easy to port by substituting something appropriate for
;; sb-introspect:function-lambda-list
;; Its easy to get confused with wrapped functions - if you redefine a
;; function while it is wrapped, it will still seem to be wrapped
;; (entry in the hash table for the name) but won't be.
(defvar *wrapped-functions* (make-hash-table))
@coldfix
coldfix / msys2.reg
Last active August 29, 2024 02:58 — forked from magthe/msys2.reg
MSYS2 "Open Here" registry settings
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\mingw32]
@="MinGW &32 Bash Here"
"Icon"="\"C:\\msys64\\mingw32.exe\""
[HKEY_CLASSES_ROOT\Directory\Background\shell\mingw64]
@="MinGW &64 Bash Here"
"Icon"="\"C:\\msys64\\mingw64.exe\""
@DKordic
DKordic / frac.min.l
Created July 24, 2016 11:45
Be rational :p .
# Just an example.
[de nop []
NIL ]
[def 'frac.min.l 'version '[2016 07 22]]
# [symbols 'frac.min.l 'pico]
[de rename [S1 S2]
[cond
[(str? S1)
@LaloHao
LaloHao / god-mode.lisp
Created July 23, 2016 03:14
A mode-line status for stumpwm analogous to emacs' god-mode using command-mode.
;;; god-mode.lisp
(defvar *god-mode-enabled* nil)
(defvar *god-mode-enabled-text* "God")
(defvar *god-mode-disabled-text* "Default")
(defun god-mode ()
"Enables or disables `god-mode' by updating variable `god-mode-enabled'."
(if *god-mode-enabled*
(setf *god-mode-enabled* nil)
(setf *god-mode-enabled* t)))

In response to REBOL versus LISP macros

This is an attempt by me to re-create the so-called definitional binding of REBOL in LISP and is a continuation of my comment here: https://news.ycombinator.com/item?id=11587952 .

We will start by loading a couple of libraries.

(ql:quickload '( :alexandria :closer-mop))
(in-package :closer-mop)
(use-package :alexandria)
@budparr
budparr / csplit.txt
Last active September 28, 2018 08:56
Terminal command to split a list of markdown items into separate documents. Given a "slug" value, the file will be named that. You could also change slug to title and create slugs/filenames from the title. You may also want to run your output through a markdown converter, like https://github.com/domchristie/to-markdown
csplit -k -n 3 export.txt '/^@@@/' {'999'}; for i in xx*; do sed -i '' 's/@@@/---/g' $i; done; for i in xx*; do mv $i `egrep -m1 -e 'slug:.*' $i | sed -e s/[^\]\[A-Za-z0-9~.,_{}\(\)\'\-\+]/-/g -e s/slug--//`.md; done