Skip to content

Instantly share code, notes, and snippets.

View dustinknopoff's full-sized avatar

Dustin Knopoff dustinknopoff

View GitHub Profile
@dustinknopoff
dustinknopoff / syncexample.md
Created April 17, 2018 18:58
NAS and External Hard Drive sync example using rsync and Automator
  1. Create Automator Folder Action.
  2. Add Folder to watch.
  3. In Picker, enter CMD + SHIFT + G and type /Volumes/
  4. Click Choose.
  5. Add Run Script to Automation.
  6. Use /bin/bash or /bin/zsh.
  7. Example rsyncs:
#!/usr/bin/env bash
@dustinknopoff
dustinknopoff / bestappsever-talk.py
Last active June 27, 2018 18:09
Attempting to Tokenize out best apps ever for MPU'ers.
from collections import Counter
import nltk
import requests
from bs4 import BeautifulSoup
# def isApp(word):
# """
# Checks to see if given word is a Mac or iOS app.
@dustinknopoff
dustinknopoff / splitPDFs.py
Last active July 8, 2018 14:33
PDF Splitter by variable intervals. Requires PyPDF2 using Python2.7. (On Macs install with "sudo pip install pypdf2" in terminal.
#!/usr/bin/env python2.7
import os
import PyPDF2
class pdfSplitter():
def __init__(self, original_pdf, out_name, splits):
"""
Creates new instance of pdfSplitter class
@dustinknopoff
dustinknopoff / searcher.sh
Last active September 1, 2018 12:30
Cobbled together fzf/rg file and contents searcher for the terminal.
# Modified version where you can press
# - CTRL-O to open with `open` command,
# - CTRL-E or Enter key to open with the $EDITOR
# - CTRL-S to search inside files
# - CTRL-C to copy file path to clipboard
# - CTRL-D to cd to directory of file
# - CTRL-N to make a new markdown file.
fs() {
local out file key
IFS=$'\n' out=($(fzf -i --preview="pygmentize -g {}" --query="$1" --exit-0 --expect=ctrl-o,ctrl-e,ctrl-s,ctrl-m,ctrl-c,ctrl-d,ctrl-x,ctrl-n --bind '?:toggle-preview'))
@dustinknopoff
dustinknopoff / .vimrc
Created September 20, 2018 15:20
My current-is vim config file.
filetype plugin indent on
:ab #b /************************************************
:ab #e ************************************************/
set nocompatible
set modelines=0
set autowrite
set backspace=indent,eol,start
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
@dustinknopoff
dustinknopoff / README.md
Last active January 1, 2019 23:32
Pythonista compatible python script for keeping track of and visualizing your numerical answer to daily questions.

Daily Tracker

How to Install

This script is intended to run in Pythonista on iOS. It works equally well on desktop OSs. Installation instructions will be solely for Pythonista.

  1. Copy the contents of this
  2. Open a new file in Pythonista called dailytracker.py and paste the contents.
  3. Click the wrench icon.
#!/usr/bin/env python3
import argparse
def naive_reverse(input_list: [str]):
new_list = []
size = len(input_list) - 1
for i in range(0, len(input_list)):
new_list.append(input_list[size - i])
return new_list
This file has been truncated, but you can view the full file.
{
"Red": {
"id": "Red",
"name": "Red Line",
"type": 1,
"options": {
"Ashmont/Braintree": 0,
"Alewife": 1
},
"stops": {
@dustinknopoff
dustinknopoff / is_reflexive.rs
Last active June 16, 2019 13:34
Is a Tree reflexive?
type OptionBranch = Option<Box<Tree>>;
#[derive(Debug)]
struct Tree {
data: i32,
branches: (OptionBranch, OptionBranch)
}
impl Tree {
fn new(data: i32) -> Self {
@dustinknopoff
dustinknopoff / fp_sort.rs
Last active June 18, 2019 12:28
Is the string sorted?
fn is_sorted(input: &str) -> bool {
let input_iter: Vec<_> = input.chars().collect();
let initial = input_iter[0];
input
.chars()
.fold(Some(initial), |acc, current| {
if acc != None {
if Some(current) >= acc {
return Some(current)
} else {