Skip to content

Instantly share code, notes, and snippets.

@saltlakeryan
saltlakeryan / 16tiles.applescript
Last active March 1, 2023 19:40
applescript to tile windows in a 4x4 grid
-- Inspirations: https://stackoverflow.com/questions/14551419/listing-all-windows-of-all-applications
-- 2: https://gist.github.com/krid78/4673164
-- 3: https://gist.github.com/dpinney/d7b83b1ac3405aee244547e42b14ce72
-- Get the size of the Display(s), only useful if there is one display
-- otherwise it will grab the total size of both displays
tell application "Finder"
set _b to bounds of window of desktop
set screen_width to item 3 of _b
set screen_height to item 4 of _b
@saltlakeryan
saltlakeryan / PodCastFeedGenerator.java
Last active July 6, 2022 20:24
generate podcast feed based on contents of directory
package com.company;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.List;
import java.util.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Locale;
@saltlakeryan
saltlakeryan / whirley.pl
Created November 10, 2021 16:36
Whirley gig progress indicator for perl
#!/usr/bin/perl
# Based on this: https://www.perlmonks.org/?node_id=113661
use strict;
use Time::HiRes qw( sleep );
#$|=1;
@saltlakeryan
saltlakeryan / example.go
Last active January 5, 2021 17:47 — forked from lmammino/example.go
Ldap filter beautifier
package main
/*
Put ldap.go in ldap subdir
Run: go build example.go
Run: ./example < ldap-filter.txt
*/
import (
"fmt"
var Scroller = (function() {
var scrollHandle = 0;
var height = () => {
var body = document.body, html = document.documentElement;
var height = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight,html.offsetHeight );
return height;
};
var slowScroll = (amt) => {
window.scrollBy({left: 0, top: amt, behavior: 'smooth'});
@saltlakeryan
saltlakeryan / fake_authentication.py
Last active February 9, 2018 21:15
fake_authentication.py
# /home/nemo/python/lib/python3.6/site-packages/NEMO/views/
# settings.py: AUTHENTICATION_BACKENDS = ['NEMO.views.fake_authentication.AllowAnyPasswordBackend']
from django.contrib.auth import get_user_model
from pprint import pprint
class AllowAnyPasswordBackend:
def authenticate(self, username=None, password=None):
User = get_user_model()
@saltlakeryan
saltlakeryan / nemo-fixtures.json
Created February 9, 2018 21:12
nemo fixtures for testing
[
{
"pk": 1,
"model": "NEMO.user",
"fields": {
"username": "cap",
"first_name": "Steven",
"last_name": "Rogers",
"qualifications": [
3,
#!/bin/bash
cd /home/nemo
pip3 install git+https://github.com/usnistgov/NEMO.git@b219bba1166b893b4223d23ed3383fbf54e77fc5 gunicorn
mkdir /home/nemo/{email,media,secrets,logs,nginx,static}
wget -q -O - https://gist.github.com/saltlakeryan/5e3b1a2612f973689f25fced3452629/raw > settings.py
nemo generate_secret_key > secrets/django_secret_key.txt
django-admin makemigrations NEMO
@saltlakeryan
saltlakeryan / settings.template.py
Last active May 19, 2018 21:53
template for nemo settings
# -------------------- Django settings for NEMO --------------------
# Customize these to suit your needs. Documentation can be found at:
# https://docs.djangoproject.com/en/1.11/ref/settings/
# Core settings
# DANGER: SETTING "DEBUG = True" ON A PRODUCTION SYSTEM IS EXTREMELY DANGEROUS.
# ONLY SET "DEBUG = True" FOR DEVELOPMENT AND TESTING!!!
DEBUG = True
AUTH_USER_MODEL = 'NEMO.User'
@saltlakeryan
saltlakeryan / setup-nemo-box.sh
Last active February 9, 2018 15:58
setup nemo and python from source
#!/bin/bash
##############################
### Run as Root: "sudo su" ###
##############################
apt-get update
apt-get install -y zlib1g-dev git curl vim gcc wget sqlite3 openssl git unzip
apt-get install -y build-essential checkinstall
apt-get install -y libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev