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
#| -------------------------------------------------------------------------- | |
KMonad: US ansi 100% template | |
This file contains the `defsrc` configuration for a standard US-ansi 100% | |
keyboard. Modelled on a standard DAS-keyboard 100%. Copy out the 'defsrc' | |
layer to start your own keyboard configuration. Copy out the `deflayer` | |
template to easily start a new layer with matching `transparent` buttons. |
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
// Task builder for F# that compiles to allocation-free paths for synchronous code. | |
// | |
// Originally written in 2016 by Robert Peele ([email protected]) | |
// New operator-based overload resolution for F# 4.0 compatibility by Gustavo Leon in 2018. | |
// Revised for insertion into FSharp.Core by Microsoft, 2019. | |
// | |
// Original notice: | |
// To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights | |
// to this software to the public domain worldwide. This software is distributed without any warranty. | |
// |
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
New-Module -Name Lk -ScriptBlock { | |
[Reflection.Assembly]::LoadWithPartialName('System.IO.Compression.FileSystem') | |
if (-not (Get-Command -ErrorAction SilentlyContinue rich)) { | |
Write-Error '`rich` not installed. See https://github.com/Textualize/rich-cli' | |
} | |
if (-not (Get-Command -ErrorAction SilentlyContinue less)) { | |
Write-Error '`less` not installed. `scoop install less` maybe?' | |
} | |
function Show-Item { | |
param( |
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
public final class ChunkedStreams { | |
private ChunkedStreams(){} | |
@SuppressWarnings("SameParameterValue") | |
public static <T> Stream<List<T>> chunks(Stream<T> sourceStream, int size) { | |
var source = sourceStream.spliterator(); | |
return StreamSupport.stream(new Spliterator<>() { | |
final List<T> buf = new ArrayList<>(); | |
@Override | |
public boolean tryAdvance(Consumer<? super List<T>> action) { |
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
# Bash function that calls `less` and `ls -l` depending on whether | |
# the target is a file or a directory. Surprisingly pleasant to use. | |
function lk { | |
local p | |
if [[ $# -lt 1 ]] ; then | |
p='.' | |
else | |
p="$1" | |
fi |
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 | |
# Simple form | |
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
# More correct/robust form, if you have time | |
SOURCE="${BASH_SOURCE[0]}" | |
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink | |
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" | |
SOURCE="$(readlink "$SOURCE")" |
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
_fill_in() { | |
perl -p -e 's/\$\{([^}]+)\}/defined $ENV{$1} ? $ENV{$1} : "\${$1}"/eg' "${1}" | |
} | |
# usage | |
export MY_VAR=15 | |
_fill_in "my_file.tmpl" > "my_file" |
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
// Proof-of-concept XorLinkedList | |
// Mostly untested! Do not use in serious code! | |
// NO WARRANTIES AT ALL! | |
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Runtime.InteropServices; |
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
[alias] | |
lg1 = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all | |
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all | |
lg = !"git lg1" |
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 | |
export AWS_ACCESS_KEY_ID=YOUR_ACCESS_KEY | |
export AWS_SECRET_ACCESS_KEY=YOUR_SECRET_ACCESS_KEY | |
export PASSPHRASE=YOU_PASSHRASE | |
# directories, space separated | |
SOURCE="/home/thomas/backup /home/thomas/bin /home/thomas/documents" | |
BUCKET=s3+http://mybucket | |
LOGFILE=/home/thomas/tmp/duplicity.log | |
# set email to receive a backup report |
NewerOlder