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
# Use a much larger DNS cache size than the default of 150 entries, which is | |
# ludicrously small | |
cache-size=4096 | |
# Use stale cache entries (up to 1 day out of date). Using stale cache data triggers | |
# a background update of the cached entry, but responds immediately. | |
use-stale-cache | |
# Query all configured DNS servers simultaneously, using the first response. | |
# Reduces response times for uncached DNS lookups. |
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
-- Encodes the provided numeral value using alpha numerals. | |
create or alter function encode_alpha(@numeral int, @a char(1)) returns varchar(32) | |
with returns null on null input as | |
begin | |
declare @result varchar(32); | |
with [alphabet] ([Value], [Char]) as ( | |
select [n].[Value], char(ascii(@a) + [n].[Value] - 1) | |
from (values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16),(17),(18),(19),(20),(21),(22),(23),(24),(25),(26)) as [n] ([Value]) | |
), |
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
' Rudimentary CSV parser in VBA. Wheee. | |
Option Explicit | |
Public Function IsEmptyRecord(ByRef record() As String) | |
IsEmptyRecord = UBound(record) = 0 And record(0) = "" | |
End Function | |
' Reads a CSV record from the provided TextStream, assigning the fields | |
' to the provided array reference. Returns True if a record is read from | |
' the TextStream, or False if the end of the stream has been reached. |
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
def urldecode: | |
def unhex: | |
if 48 <= . and . <= 57 then . - 48 elif 65 <= . and . <= 70 then . - 55 else . - 87 end; | |
def bytes: | |
def loop($i): | |
if $i >= length then empty else 16 * (.[$i+1] | unhex) + (.[$i+2] | unhex), loop($i+3) end; | |
[loop(0)]; | |
def codepoints: |
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/bash | |
function levenshtein() { a="$1"; b="$2"; | |
if [ "$a" == "$b" ]; then echo 0; return 0; fi | |
if [ 0 -eq ${#a} ]; then echo ${#b}; return 0; fi | |
if [ 0 -eq ${#b} ]; then echo ${#a}; return 0; fi | |
d0=(0) | |
d1=() | |
for i in $(seq 1 ${#b}); do d0[$i]=$i; done |
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/bash | |
# | |
# transcode.sh | |
# | |
# Transcodes a tree of FLAC files in a specified source directory to a matching tree of | |
# Opus files in the specified destination directory. | |
scriptName=$(basename "$0") | |
sourceDirectory="${1%/}" | |
destinationDirectory="${2%/}" |
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/bash | |
ldapsearch "$@" | sed -n '1h; 1!H; ${ g; s/\r\?\n //g; p }' |
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/bash | |
while true; do | |
ls /run/user/$UID/gvfs/* &> /dev/null | |
sleep 15 | |
done |
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/bash | |
#========== | |
# Uses the GIMP to set the specified DPI value on the specified image without | |
# changing the dimensions of the image. | |
# | |
# This is useful as Inkscape provides no means of changing the DPI of an exported | |
# image without altering its pixel count, and also defaults to 90dpi. | |
# | |
# Note that gimp-console must be in your $PATH. |
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
trait JsonDialect { dialect => | |
import scala.language.implicitConversions | |
type JValue | |
type JArray <: JValue | |
type JBoolean <: JValue | |
type JNull <: JValue | |
type JNumber <: JValue | |
type JObject <: JValue | |
type JString <: JValue |
NewerOlder