This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shlex,subprocess | |
def fzf(input,multi=False,args="",outf=lambda b:b.decode()): | |
cmd = ["fzf","--read0","--print0",*(["--multi"] if multi else []),*shlex.split(args)] | |
enc = lambda b:{bytes:lambda v:v,str:lambda v:v.encode()}.get(type(b),lambda v:str(v).encode())(b) | |
p = subprocess.run(cmd,input=b"\x00".join([enc(i) for i in input or []]),stdout=subprocess.PIPE) | |
if multi: | |
return [outf(i) for i in p.stdout.rstrip(b"\x00").split(b"\x00")] | |
else: | |
return outf(p.stdout.rstrip(b"\x00")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="description" content="lit-html starter"> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>LitHTML</title> | |
<script type="module"> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# vim: set ts=4: | |
#---help--- | |
# Usage: alpine-chroot-install [options] | |
# | |
# This script installs Alpine Linux into a chroot and optionally sets up | |
# qemu-user and binfmt to emulate different architecture (e.g. armhf). | |
# | |
# If qemu-user and binfmt is needed, the script checks if both are available. | |
# If not, it tries to install them using apt-get. Beside this the script should |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shlex | |
# | |
# Some useful utils for BitBar/SwiftBar | |
# | |
class Line: | |
def __init__(self,text,**params): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import pprint,re,subprocess,sys | |
# | |
# Simple parser for 'launchctl list <service>' output | |
# | |
# This works for simple outputs (which is true in most cases) but will fail for | |
# complex outputs - in particular nested arrays/dicts | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# XXX THIS DOESN'T WORK XXX | |
awk -v key="${1?Usage: yaml_get_section <section>}" -v debug=${DEBUG-0} ' | |
BEGIN { | |
found = 0 | |
multiline = 0 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# KEYWORD: firstboot | |
# PROVIDE: bhyve_cloudinit | |
# REQUIRE: NETWORKING | |
# BEFORE: LOGIN | |
. /etc/rc.subr | |
: ${bhyve_cloudinit_enable:="NO"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Host network configuration | |
GW=$(route -6 get default | awk '/gateway/ { split($2,a,"%"); print a[1] }') | |
EXT_IFACE=$(route -6 get default | awk '/interface/ { print $2 }') | |
EXT_INET6=$(ifconfig $EXT_IFACE inet6 | awk '/inet6 2/ { print $2; exit }') | |
JAIL=${JAIL-ipv6test} | |
# Create bridge | |
if [ "${BRIDGE}" == "" ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<configuration version="32"> | |
<folder id="default" label="Default Folder" path="/syncthing/Default Folder" type="sendreceive" rescanIntervalS="3600" fsWatcherEnabled="true" fsWatcherDelayS="10" ignorePerms="false" autoNormalize="true"> | |
<filesystemType>basic</filesystemType> | |
<device id="ZZUFR4D-J2HAHRQ-P2HX2QO-BJIUR2R-RH74FDD-BTD2UTK-LS7G2R5-BLPNLA5" introducedBy=""></device> | |
<device id="7WVD7UP-Y2JNG3R-LOXIT4V-2P7GREB-BTZM7LK-XJEBJ4Z-QI4CUUE-FWJYSQA" introducedBy=""></device> | |
<minDiskFree unit="%">1</minDiskFree> | |
<versioning> | |
<cleanupIntervalS>0</cleanupIntervalS> | |
</versioning> | |
<copiers>0</copiers> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<host> { | |
root * /var/flarum/public | |
php_fastcgi 127.0.0.1:9000 | |
file_server | |
header /assets { | |
+Cache-Control "public, must-revalidate, proxy-revalidate" | |
+Cache-Control "max-age=25000" | |
Pragma "public" | |
} | |
encode gzip |