Skip to content

Instantly share code, notes, and snippets.

roytanck / autoautoptimize.php
Last active Nov 23, 2020
Auto-configure Autoptimize across a WordPress network
View autoautoptimize.php
* Plugin Name: RT Autoautoptimize
* Plugin URI:
* Description: Automatically configures default settings for the Autoptimize plugin across a WordPress network
* Version: 0.9
* Author: Roy Tanck
* Author URI:
* License: GPL2
domenic /
Last active Apr 26, 2021
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with GitHub Actions

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

A file below this one contains the steps for doing this with Travis CI. However, these days I recommend GitHub Actions, for the following reasons:

  • It is much easier and requires less steps, because you are already authenticated with GitHub, so you don't need to share secret keys across services like you do when coordinate Travis CI and GitHub.
  • It is free, with no quotas.
  • Anecdotally, builds are much faster with GitHub Actions than with Travis CI, especially in terms of time spent waiting for a builder.
View count.js
var actionUtil = require('sails/lib/hooks/blueprints/actionUtil');
module.exports = function getCount (req, res) {
var Model = actionUtil.parseModel(req)
, criteria = actionUtil.parseCriteria(req);
Model.count(criteria, function(error, response) {
if (error) {
return res.serverError('database_error', error);
View disposable-email-provider-domains
vukicevic / Draw Bitmap From Int Array
Last active Apr 3, 2021
Generate a monochrome bitmap image in JavaScript using a byte-array. The image is generated such that every bit in the array is shown as either a black (1) or white (0) pixel.
View Draw Bitmap From Int Array
* depth: 1 - monochrome
* 4 - 4-bit grayscale
* 8 - 8-bit grayscale
* 16 - 16-bit colour
* 32 - 32-bit colour
function drawArray(arr, depth) {
var offset, height, data, image;
hpcorona / squid.conf
Created Mar 1, 2013
simple squid3 configuration to allow all to connect to all
View squid.conf
#Recommended minimum configuration:
acl manager proto cache_object
acl localhost src
acl to_localhost dst
acl localnet src
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
KartikTalwar /
Last active May 18, 2021
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
mrbongiolo / fql_query_page_photos.fql
Last active Jun 22, 2016
Query for FQL to get all photos from a Facebook Page albums and all photos tagged with that Facebook Page
View fql_query_page_photos.fql
# Formatted for readability
SELECT src, src_height, src_width, src_small, src_small_height, src_small_width
FROM photo
FROM photo_tag
WHERE subject='243117879034102' )
pid IN (SELECT pid
FROM photo