Skip to content

Instantly share code, notes, and snippets.

@wdkrnls
wdkrnls / dmenu_hlwm_add_tags
Created March 31, 2018 04:46
dynamically add tags to hlwm using dmenu
#!/bin/bash
### License: GPL3+
#
# Author: Kyle Andrews
#
# This script enables dynamic creation of new tags in hlwm.
#
###
@wdkrnls
wdkrnls / dmenu_hlwm_del_tags
Last active March 31, 2018 04:45
dynamically delete hlwm tags with dmenu
#!/bin/bash
### License: GPL3+
#
# Author: Kyle Andrews
#
# This script enables dynamic creation of new tags in hlwm.
#
###
@wdkrnls
wdkrnls / dmenu_hlwm_rename_tags
Created March 31, 2018 04:43
dynamically rename tags in hlwm using dmenu
#!/bin/bash
### License: GPL3+
#
# Author: Kyle Andrews
#
# This script enables dynamic creation of new tags in hlwm.
#
###
@wdkrnls
wdkrnls / wallpaper.sh
Created January 5, 2018 03:48
Set wallpaper independently for each tag in herbstluftwm
#!/bin/bash
# This code was modified from Thorsten by me:
# https://bbs.archlinux.org/viewtopic.php?pid=1024618#p1024618
# sets a tag defined wallpaper when tag changes
declare -A WALLPAPER
# These wallpapers come with Deepin desktop environment, but also look great in hlwm
DIR=/usr/share/backgrounds
@wdkrnls
wdkrnls / linear-sinesoidal-regression.R
Created January 4, 2018 06:19
naive implementation of linear sinesoidal regression
# Kyle Andrews
# This code implements math derived by Jean Jacquelin
# License: GPL3+
rm(list = ls())
library(pracma)
x <- sort(runif(20, max = 10))
n <- length(x)
a0 <- 0
@wdkrnls
wdkrnls / hlwm.el
Created November 11, 2017 12:44
hlwm.el: control herbstluftwm from emacs
;;;; HLWM convience tools
;; author: Kyle Andrews
;; license: GPL V3 or later
(defun bash-path ()
"Return all the executables in the path according to bash.
This does not work as well as dmenu-path since it includes bash
reserved words in the result."
@wdkrnls
wdkrnls / polyfun.R
Last active November 4, 2017 19:19
make polynomial function
# Author: Kyle Andrews
# License: GPL3+
# Date: 2017-11-04
# Description: Make a higher order function that returns a function that returns a function for exploring polynomial equations.
#' Test if all elements in vector are unique.
#' @param x Vector.
#' @return Logical Scalar.
all_unique <- function(x) {
length(x) == length(unique(x))
@wdkrnls
wdkrnls / some_experiments.R
Last active February 6, 2017 02:07
Some weekend experiments I made with R. No premature optimization here.
# Author: Kyle Andrews
# GPL3+ license applies.
#' parallel index map function for univariate data.
#' @param f Function -> Vector.
#' @param xs Vector.
#' @param ys Vector.
#' @param ... Extra arguments to f.
#' @examples
@wdkrnls
wdkrnls / chunk_text.R
Created January 31, 2017 02:10
Chunk a text string into k strings.
chunk_text <- function(txt, k) {
n <- nchar(txt)
q <- n %/% k
r <- n %% k
unlist(lapply(seq.int(1, k), function(i) {
substr(txt, start = (i - 1)*q + min(i - 1, r) + 1, stop = i * q + min(i, r))
}), recursive = FALSE)
}
#!/usr/bin/env racket
#lang racket/base
(require racket/vector)
;; Capture the command line args sent to this script
(define args
(current-command-line-arguments))