Skip to content

Instantly share code, notes, and snippets.

View npazo's full-sized avatar

Nick Pazoles npazo

  • Sports Reference LLC
  • Chicago-adjacent
View GitHub Profile
@dex4er
dex4er / ssm.sh
Last active September 19, 2023 08:47
ssm
#!/usr/bin/env bash
## ssm
##
## Copyright (c) 2023 Piotr Roszatycki <piotr.roszatycki@gmail.com>, MIT
set -e
if ! command -v aws >/dev/null; then
echo "Needs aws command."
@ttscoff
ttscoff / sizes.rb
Last active July 12, 2021 03:33
sizes: Calculate and sort all filesizes for current folder
#!/usr/bin/env ruby
# Sizes - Calculate and sort all filesizes for current folder Includes
# directory sizes, colorized output Brett Terpstra 2019 WTF License
VERSION = "1.0.1"
require 'shellwords'
# Just including term-ansicolor by @flori and avoiding all the
# rigamarole of requiring multiple files when it's not a gem... - Brett
#
@milanaleksic
milanaleksic / functions.sh
Created May 12, 2017 08:45
List all known functions
# as long as your functions are located in files mentioned in the "in" clause of the for below
# and as long as functions are following the same pattern of "function_name() {" with a single comment above,
# the function below will list them all in a nice way
# lists all known functions
functions() {
for f in ~/.dockerfunc ~/.functions ~/bash/.extra_*
do
@flomotlik
flomotlik / functions.sh
Created September 28, 2016 11:22
Pull Request handling
# Checkout a PR from the current repo
function copr { git fetch origin pull/$1/head:pr-$1; git checkout pr-$1; }
# Get the current PR from the branch name
function current_pr {
git rev-parse --abbrev-ref HEAD | grep -oE "\d+"
}
# Update the PR
function upr {
@ttscoff
ttscoff / csv-to-mmd-tables.rb
Last active December 1, 2017 02:18
A messy script for converting simple CSV syntax to MultiMarkdown tables, for use in the Markdown Service Tools <http://brettterpstra.com/projects/markdown-service-tools/>
#!/usr/bin/env ruby
require 'csv'
# md - Tables - Create from CSV
# v1.1 2016-08-17
# From the Markdown Service Tools <http://brettterpstra.com/projects/markdown-service-tools/>
# Converts CSV style input to MultiMarkdown tables
# Changelog
# 1.1: Fixed error when line ended with whitespace in middle of input
@JustThomas
JustThomas / wordpress-multisite-internal-redirect-loop.md
Last active June 19, 2024 15:34
WordPress Multisite: How to fix error "too many redirects"

WordPress Multisite: How to fix error "Request exceeded the limit of 10 internal redirects"

I am running a WordPress multisite network with sub-directory setup. When I check my error.log file, it is full of entries like this one:

Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'Limit InternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

The problem was, in my case, one specific rewrite rule in the .htaccess file.

Problem description

@twetzel
twetzel / deploy.rb
Last active February 22, 2018 09:37 — forked from Jesus/deploy.rb
compile assets local with capistrano 3.2.1 and rails 4.1.1 (fully integrated)
# Clear existing task so we can replace it rather than "add" to it.
Rake::Task["deploy:compile_assets"].clear
namespace :deploy do
desc 'Compile assets'
task :compile_assets => [:set_rails_env] do
# invoke 'deploy:assets:precompile'
invoke 'deploy:assets:precompile_local'
invoke 'deploy:assets:backup_manifest'
anonymous
anonymous / -
Created May 15, 2014 21:06
#!/bin/sh
### BEGIN INIT INFO
# Provides: unicorn
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start unicorn at boot time
# Description: Run input app server
### END INIT INFO
@edooley
edooley / application.rb
Last active December 15, 2015 12:29
My approach to Rails app versioning. Keep up with your VCS tags and forget about the rest! (git shown here)
# Only attempt update on local machine
if Rails.env.development?
# Update version file from latest git tag
File.open('config/version', 'w') do |file|
file.write `git describe --tags --always` # or equivalent
end
end
config.version = File.read('config/version')
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: