Skip to content

Instantly share code, notes, and snippets.

@will-wright-eng
will-wright-eng / loc.sh
Created December 15, 2025 22:23
bash script for counting lines of code in a directory tree
#!/bin/bash
#
# loc_counter.sh - Count lines of code by file extension in a directory
#
# Usage:
# ./loc_counter.sh [directory_path]
#
# If no directory_path is provided, it defaults to the current directory.
set -e
#!/bin/bash
# Mouse mover script for macOS using cliclick
# Moves mouse every 5 minutes to prevent sleep/screensaver
# Install cliclick first: brew install cliclick
# Configuration
INTERVAL=300 # 5 minutes in seconds
MOVE_DISTANCE=10 # pixels to move
LOG_FILE="./mouse_mover.log"
@will-wright-eng
will-wright-eng / just_text.py
Created September 15, 2020 06:49 — forked from Smerity/just_text.py
Extract just the text from Common Crawl WARC WET files
# To run: python just_text.py > text
###
from glob import glob
#
import warc
# List any of the WARC files found in the data folder
warc_files = glob('data/*.wet.gz')
# Process each of the WARC files we found
@will-wright-eng
will-wright-eng / search_biopython.py
Created July 2, 2018 02:34 — forked from bonzanini/search_biopython.py
Searching PubMed with Biopython
# you need to install Biopython:
# pip install biopython
# Full discussion:
# https://marcobonzanini.wordpress.com/2015/01/12/searching-pubmed-with-python/
from Bio import Entrez
def search(query):
Entrez.email = 'your.email@example.com'
@will-wright-eng
will-wright-eng / pubmed_ask.r
Created July 2, 2018 02:27 — forked from briatte/pubmed_ask.r
pubmed scraper
#' Get a PubMed search index
#' @param query a PubMed search string
#' @return the XML declaration of the search
#' @example
#' # Which articles discuss the WHO FCTC?
#' pubmed_ask("FCTC OR 'Framework Convention on Tobacco Control'")
pubmed_ask <- function(query) {
# change spaces to + and single-quotes to URL-friendly %22 in query
query = gsub("'", "%22", gsub(" ", "+", query))