Skip to content

Instantly share code, notes, and snippets.

View chrisburnell's full-sized avatar
🇸🇬
Looking for work in Singapore!

Chris Burnell chrisburnell

🇸🇬
Looking for work in Singapore!
View GitHub Profile
@xdesro
xdesro / .eleventy.js
Created October 27, 2022 19:44
Hint VS Code for eleventyConfig autocompletion.
/**
* @param {import("@11ty/eleventy/src/UserConfig")} eleventyConfig
*/
module.exports = (eleventyConfig) => {
return {};
};
@thykka
thykka / inverted_wikipedia.user.js
Created April 8, 2020 18:26
wikipedia night mode 😎
// ==UserScript==
// @name Inverted wikipedia
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Invert, except images. Terrible for perf, probably...
// @author Thykkkz
// @match https://*.wikipedia.org/wiki/*
// @grant none
// ==/UserScript==
@adactio
adactio / playSparkline.js
Last active June 11, 2023 21:17
A function to convert numbers into sound.
// Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
// http://creativecommons.org/publicdomain/zero/1.0/
// Pass in an array of numbers ranging from 0 to 20.
function playSparkline(notes) {
if (!window.AudioContext && !window.webkitAudioContext) {
return;
}
var playing = null;
# get total requests by status code
awk '{print $9}' /var/log/nginx/access.log | sort | uniq -c | sort -rn
# get top requesters by IP
awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head | awk -v OFS='\t' '{"host " $2 | getline ip; print $0, ip}'
# get top requesters by user agent
awk -F'"' '{print $6}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head
# get top requests by URL
@paulirish
paulirish / bling.js
Last active May 1, 2024 19:56
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
@adactio
adactio / micropub.php
Last active January 20, 2023 16:09
Minimal micropub endpoint.
<?php
# Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
# http://creativecommons.org/publicdomain/zero/1.0/
$mysite = 'https://adactio.com/'; // Change this to your website.
$token_endpoint = 'https://tokens.indieauth.com/token';
$_HEADERS = array();
foreach(getallheaders() as $name => $value) {
@codepo8
codepo8 / redirect
Last active June 29, 2021 16:58
Simple redirect of hotlinked images in .htaccess
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
# allowed domains, add as needed
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?christianheilmann.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?wait-till-i.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?mozilla.org [NC]
# search engines and social sites and stuff