Skip to content

Instantly share code, notes, and snippets.

View claytron's full-sized avatar
😎
My future is so bright.

Clayton Parker claytron

😎
My future is so bright.
View GitHub Profile
@claytron
claytron / .gitignore
Last active April 29, 2024 13:16
Trakt VIP backup sync to Letterboxd
letterboxd.csv*
@claytron
claytron / mirror-repos.py
Created January 18, 2013 23:57
Script to mirror repos from an organization
#!/usr/local/bin/python
# this script gets the JSON from api.github for a user
# and mirrors (or fetches, for existing) that user's repos
import os
import sys
import json
import urllib2
import subprocess
@claytron
claytron / mru.vim
Created January 23, 2016 22:22
Most Recently Used Buffer search using FZF in Vim
" Use 'ffr' in normal mode to start it
nmap ffr :MRUFilesCWD<CR>
" MRU handling, limited to current directory
command! MRUFilesCWD call fzf#run({
\ 'source': s:mru_files_for_cwd(),
\ 'sink': 'edit',
\ 'options': '-m -x +s --prompt=MRU:'.shellescape(pathshorten(getcwd())).'/',
\ 'down': '40%' })
@claytron
claytron / delayed_job_error_escalate.rb
Created March 14, 2017 20:43
Show how long a DelayedJob will take to finish out its attempts
def human_time(t)
mm, ss = t.divmod(60)
hh, mm = mm.divmod(60)
dd, hh = hh.divmod(24)
"#{dd}d #{hh}h #{mm}m #{ss}s"
end
# Default attempts is 25
max_attempts = ARGV[0] ? ARGV[0].to_i : 25
cumulative_time = 0
@claytron
claytron / fzf.sh
Created January 23, 2016 22:38
FZF Config
# My defaults for FZF (mostly changed to see hidden files)
export FZF_DEFAULT_COMMAND='find -L . -type f -o -type d -o -type l | sed 1d | cut -b3- | grep -v -e .git/ -e .svn/ -e .hg/'
export FZF_CTRL_T_COMMAND=$FZF_DEFAULT_COMMAND
# Enhance the default experience
export FZF_DEFAULT_OPTS='--extended --multi --inline-info --prompt="fzf> "'
@claytron
claytron / metrics.sh
Created January 8, 2016 16:48
Get rubocop metrics details
#!/usr/bin/env bash
# Example output:
#
# Metrics/PerceivedComplexity
# Min: 8 Max: 96 Average: 14.628342
cops=(
Metrics/AbcSize
Metrics/ClassLength
@claytron
claytron / plone.app.toolbar
Created July 14, 2013 17:00
Merge of plone.app.toolbar and plone.app.widgets issues into mockup tracker
Could not create label Bug
Could not create label Feature
Could not create label toolbar
Loaded issues 1 29
Loaded issues 2 0
Importing issue Personal-tools should come last in the DOM of the toolbar (127)
Successfully created issue Personal-tools should come last in the DOM of the toolbar (45)
Successfully imported comments in Personal-tools should come last in the DOM of the toolbar (45)
Importing issue Upon edit success, page should reload if #portal-column-content is not found (126)
@claytron
claytron / retro-clock.sh
Created November 28, 2012 15:45
Sweet retro clock
#!/bin/sh
while true
do
sleep 5
clear
figlet -w 200 -f smslant `date +"%H : %M"`
done
@claytron
claytron / debug.cfg
Created November 14, 2011 04:01
Debug configuration for Plone 4
[debugging]
parts =
zopepy
pylint
pyflakes
pep8
# plone.reload:
# you can reload the zcml in your site by running the following
# http://<zope host>:<zope port>/@@reload
@claytron
claytron / .zshrc
Created April 9, 2011 02:08
Whole line completion for ZSH
# Set up a sane modern history
setopt HIST_SAVE_NO_DUPS
setopt HIST_IGNORE_ALL_DUPS
setopt EXTENDED_HISTORY
HISTSIZE=50000
SAVEHIST=50000
HISTFILE=~/.zsh_history
export HISTFILE HISTSIZE SAVEHIST
# Look for a command that started like the one starting on the command line.