Skip to content

Instantly share code, notes, and snippets.

View weskerfoot's full-sized avatar

Wesley Kerfoot weskerfoot

View GitHub Profile
@weskerfoot
weskerfoot / continue_ftp.sh
Created December 23, 2020 17:00
Resume upload of a folder to a remote server using LFTP #lftp
lftp -e 'mirror -c -R /path/to/local/folder /path/to/remote/folder' -u 'your_username,your_password' the-remote-ftp-server.com
# -c means resume the upload where you left off the last time you ran lftp before it got terminated.
# -R means reverse mirror. This will tell lftp to upload from local to remote, instead of download from remote to local.
import strformat
import karax / [karaxdsl, vdom]
# want to use this like so
# linkItem:
# a(href="/"): text "Main Page"
template linkItem(body: untyped): VNode =
buildHtml(li(class="hover:underline text-center")):
h4:
li: body
@weskerfoot
weskerfoot / playwav.c
Created September 23, 2019 06:26 — forked from armornick/playwav.c
Play a sound with SDL2 (no SDL_Mixer)
#include <SDL2/SDL.h>
#define MUS_PATH "Roland-GR-1-Trumpet-C5.wav"
// prototype for our audio callback
// see the implementation for more information
void my_audio_callback(void *userdata, Uint8 *stream, int len);
// variable declarations
static Uint8 *audio_pos; // global pointer to the audio buffer to be played
@weskerfoot
weskerfoot / arch-linux-install
Created April 8, 2018 07:09 — forked from binaerbaum/arch-linux-install
Minimal instructions for installing arch linux on an UEFI NVMe system with full system encryption using dm-crypt and luks
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# Set swiss-french keymap
from math import log
def calcShannonEnt(dataSet):
numEntries = len(dataSet)
labelCounts = {}
for featVec in dataSet:
currentLabel = featVec[-1]
if currentLabel not in labelCounts.keys():
labelCounts[currentLabel] = 0
else:
#lang racket
;; hello world in Racket
;; comments begin with ;
;; some people like to use ;;
;; function application is done by surrounding the function name and arguments in parens
;;
;; if you have seen languages like Python or JavaScript, f(a,b,c) is (f a b c) in scheme
(displayln "Hello, world!")