Skip to content

Instantly share code, notes, and snippets.

View blefev's full-sized avatar

Brendan Lefevre blefev

View GitHub Profile
@stevethedev
stevethedev / variety-sort.js
Created April 13, 2018 16:26
A Variety-Sort in ES6
function varietySort(array) {
// 1. Cut the list in half
const [ left, right ] = varietySort.split(array);
varietySort.rejoin(
array,
varietySort.left(left),
varietySort.right(right)
);
return array;
}
@Ryex
Ryex / killseedboxrsync
Created May 22, 2016 21:45
seedbox rsync automation: down load all files from a seed box or other remote server with rsync
#!/bin/bash
pid_file="/path/to/destination/rsync.pid"
rsync_pid=$(cat $pid_file)
if [[ -z "${rsync_pid// }" ]] ; then
echo "[$(date)] no PID for seedbox rsync, exiting"
exit
else
@StevenLooman
StevenLooman / match.magik
Created July 20, 2012 18:59
The classic match(), version in Smallworld/Magik
#/* matchere: search for regexp at beginning of text */
#int matchhere(char *regexp, char *text) {
# if (regexp[0] == '\0')
# return 1;
# if (regexp[1] == '*')
# return matchstar(regexp[0], regexp+2, text);
# if (regexp[0] == '$' && regexp[1] == '\0')
# return *text == '\0';
# if (*text!='\0' && (regexp[0]=='.' || regexp[0]==*text))
# return matchhere(regexp+1, text+1);