Skip to content

Instantly share code, notes, and snippets.

View joshuata's full-sized avatar

Josh Asplund joshuata

View GitHub Profile
@joshuata
joshuata / xdg.vim
Last active August 19, 2022 19:29 — forked from dkasak/xdg.vim
vim XDG Base Directory support
" XDG Environment For VIM
" =======================
"
" References
" ----------
"
" - http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html#variables
" - http://tlvince.com/vim-respect-xdg
" - https://gist.github.com/kaleb/3885679 (the original version)
"
@joshuata
joshuata / 0_gistfile1.md
Last active July 26, 2022 19:33
Setting up spotlight search using elasticsearch and Samba on TrueNAS 12

IMPORTANT: This is not safe! This currently requires root login over SSH.

Step 0: Enable SSH password login for root on TrueNAS. This is a huge security risk, so only do this if the system is completely firewalled from the open internet, and if there is no mission-critical data on the NAS.

First off, you will need a host running docker. Maybe eventually I will figure out a way to run this all natively, but that time is not now.

Create a folder each for your elasticsearch data and fscrawler configuration. They are labeled $ES_DATA and $FSCRAWL_CONFIG in this write-up.

Next you will need an fscrawler configuration file. This file will be placed at $FSCRAWL_CONFIG/$JOBNAME/_settings.yaml. I have included an example below, but you will need to fill in the details for your own system. I disabled the index_content settings to reduce space usage, but that can be changed for your own usage. You can also enable PDF OCR if desired.

@joshuata
joshuata / boxstarter.ps1
Last active June 24, 2019 15:24 — forked from jessfraz/boxstarter.ps1
Boxstarter Commands for a new Windows box.
# Description: Boxstarter Script
# Author: Jess Frazelle <jess@linux.com>
# Last Updated: 2017-09-11
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
{
"keyboard": "ergodox_infinity",
"keymap": "ergodox_infinity_vigilant",
"layout": "LAYOUT_ergodox_pretty",
"layers": [
[
"KC_EQL",
"KC_1",
"KC_2",
"KC_3",
#! /usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
if [[ $(whoami) != 'root' ]]; then
exit 1
fi
read -r -p 'Is this a Samba share? [Y/n] ' SMB
read -r -p 'Enter Time Machine Hostname: ' HOSTNAME
@joshuata
joshuata / 0001-fix-binaryen.patch
Created April 13, 2017 01:35
Patch to land binaryen in homebrew
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b9e135e..f7ba5c7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,6 @@
PROJECT(binaryen C CXX)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.7)
+INCLUDE(GNUInstallDirs)
IF(NOT CMAKE_BUILD_TYPE)
@joshuata
joshuata / encoding.smt
Last active August 24, 2016 22:04
Encoding rules for blocking communications
(declare-datatypes () ((Send (mk-send (src Int) (dest Int) (tag Int) (order Int) (time Int)))
(Recv (mk-recv (src Int) (dest Int) (tag Int) (order Int) (time Int)))))
(declare-fun match (Send Recv) Bool)
(define-fun canmatch ((s Send) (r Recv)) Bool
(and (or (= (src s) (src r))
(= (src r) 0))
(or (= (tag s) (tag r))
(= (tag r) 0))
(= (dest s) (dest r))))
import pandas as pd
import numpy as np
import re
# Read csv file in to dataframe, set '-' to be empty
df = pd.read_csv('gradebook.csv', na_values=['-'])
# Fill empty entries with 0
df = df.fillna(0.0)
# Regex matcher for Assessment column names

Keybase proof

I hereby claim:

  • I am joshuata on github.
  • I am joshuata (https://keybase.io/joshuata) on keybase.
  • I have a public key whose fingerprint is FB18 9B3D CA28 6618 2DFB 1234 F859 566A F65B E36D

To claim this, I am signing this object: