Skip to content

Instantly share code, notes, and snippets.

View lucyllewy's full-sized avatar

Lucy Llewellyn lucyllewy

View GitHub Profile
SYSTEMD_EXE="$(command -v systemd)"
if [ -z "$SYSTEMD_EXE" ]; then
if [ -x "/usr/lib/systemd/systemd" ]; then
SYSTEMD_EXE="/usr/lib/systemd/systemd"
else
SYSTEMD_EXE="/lib/systemd/systemd"
fi
fi
function is_wsl() {
[ -n "$WSL_DISTRO_NAME" ] && return 0 || return 1
}
if is_wsl; then
#####
## Autorun for the gpg-relay bridge
##
SOCAT_PID_FILE=$HOME/.gnupg/socat-gpg.pid
SOCAT_PID_FILE2=$HOME/.gnupg/socat-gpg.pid.2
name: warzone2100 # no spaces, all lower-case
# summary, description, and icon are parsed from the appdata/metainfo file
adopt-info: warzone2100
confinement: strict
grade: stable
base: core18
apps:
warzone2100:
command: usr/bin/warzone2100
@lucyllewy
lucyllewy / not-gravatar.php
Created June 16, 2020 17:19 — forked from jdembowski/not-gravatar.php
Use Gravatar images in WordPress but don't reveal the Gravatar img src URL. Display the Gravatar inline instead.
<?php
/*
Plugin Name: Tin Foil Hat Gravatars
Description: Use Gravatars but don't use Gravatars. What? Shut up.
Author: Jan Dembowski
Author URI: https://blog.dembowski.net/
Version: 0.7
License: GPL2
*/
@lucyllewy
lucyllewy / sanpcraft.yaml
Created December 10, 2019 11:47
snapcraft for jellyfin
name: jellyfin
adopt-info: jellyfin
summary: The Free Software Media System
description: >
Jellyfin is a Free Software Media System that puts you in control
of managing and streaming your media. It is an alternative to the
proprietary Emby and Plex, to provide media from a dedicated
server to end-user devices via multiple apps. Jellyfin is
descended from Emby's 3.5.2 release and ported to the .NET Core
framework to enable full cross-platform support. There are no
This file has been truncated, but you can view the full file.
package wordpress;
extern class GLOBALS {
public static inline function trackback_response(?error:Dynamic, ?error_message:String):Dynamic return php.Syntax.call('trackback_response', error, error_message);
public static inline function _get_cron_lock():Dynamic return php.Syntax.call('_get_cron_lock');
public static inline function do_activate_header():Dynamic return php.Syntax.call('do_activate_header');
public static inline function wpmu_activate_stylesheet():Dynamic return php.Syntax.call('wpmu_activate_stylesheet');
public static inline function logIO(io:String, msg:String):Dynamic return php.Syntax.call('logIO', io, msg);
public static inline function test(test:Map<String,Array<String>>):Map<String,Int> return php.Syntax.call('test', test);
public static inline function tokenize(file:Dynamic):Dynamic return php.Syntax.call('tokenize', file);
public static inline function display_header(?body_classes:String):Dynamic return php.Syntax.call('display_header', body_classes);
@lucyllewy
lucyllewy / snapcraft.jsonnet
Last active July 17, 2019 22:03
Example of a snapcraft.yaml created with sc-jsonnet and the accompanying jsonnet file it was created from
local snapcraft = import 'snapcraft.libsonnet';
local alsa = import 'https://raw.githubusercontent.com/diddlesnaps/snapcraft-alsa/cfbd336/alsa.libsonnet';
local preload = import 'https://raw.githubusercontent.com/diddlesnaps/snapcraft-preload/7d22e2f/snapcraft-preload.libsonnet';
local desktop = import 'https://raw.githubusercontent.com/diddlesnaps/snapcraft-desktop-helpers/a7797f1/desktop-helpers.libsonnet';
snapcraft {
name: "gnome-twitch",
"adopt-info": "gnome-twitch",
version: "0.4.2",
summary: "Enjoy Twitch on your GNU/Linux desktop",
@lucyllewy
lucyllewy / snapcraft.json
Last active January 22, 2019 14:55
snapcraft experimental schema
{"$schema":"http://json-schema.org/draft-04/schema#","definitions":{"grammar-string":{"oneOf":[{"type":"string","usage":"<string>"},{"type":"array","items":{"minitems":1,"uniqueItems":true,"oneOf":[{"type":"object","usage":"on <selector>[,<selector>...]:","additionalProperties":false,"patternProperties":{"^on\\s+.+$":{"$ref":"#/definitions/grammar-string"}}},{"type":"object","usage":"to <selector>[,<selector>...]:","additionalProperties":false,"patternProperties":{"^to\\s+.+$":{"$ref":"#/definitions/grammar-string"}}},{"type":"object","usage":"try:","additionalProperties":false,"patternProperties":{"^try$":{"$ref":"#/definitions/grammar-string"}}},{"type":"object","usage":"else:","additionalProperties":false,"patternProperties":{"^else$":{"$ref":"#/definitions/grammar-string"}}},{"type":"string","pattern":"else fail"}]}}]},"grammar-array":{"type":"array","minitems":1,"uniqueItems":true,"items":{"oneOf":[{"type":"string","usage":"<string>"},{"type":"object","usage":"on <selector>[,<selector>...]:","additionalP
const Benchmark = require('benchmark')
const WARN_RANGE = 5
const suite = new Benchmark.Suite({
onCycle (event) {
const bench = event.target
const prev = this.previous && this.previous[bench.name]
const pctDelta = prev && (((bench.stats.mean - prev.stats.mean) / prev.stats.mean) * 100)
let colorDiff = !prev
? ''
: `${pctDelta > 0 ? '+' : ''}${pctDelta.toFixed(2)}% `