Skip to content

Instantly share code, notes, and snippets.

View adfinlay's full-sized avatar

Andrew Finlay adfinlay

View GitHub Profile
@adfinlay
adfinlay / clear-rmq-mgmt-db.sh
Created December 20, 2018 11:14
Clear RMQ management DB
#! /usr/bin/env bash
sudo rabbitmqctl eval 'supervisor2:terminate_child(rabbit_mgmt_sup_sup, rabbit_mgmt_sup), rabbit_mgmt_sup_sup:start_child().'
@adfinlay
adfinlay / unused_routes_and_actions.sh
Created May 28, 2018 08:54
List unused Symfony routes and controller actions
#!/usr/bin/env bash
echo Unused routes
bin/console router:debug | awk '{ print $1 }' | sort | uniq | grep -vE '(_profiler|_wdt|_configurator|Name|router)' | xargs -I {} sh -c "echo {} \`git grep \'{}\' | wc -l\`" | awk '{ if ($2 == "0") print $1 }'
# If Symfony 2 use below (app/console instead of bin/console
#app/console router:debug | awk '{ print $1 }' | sort | uniq | grep -vE '(_profiler|_wdt|_configurator|Name|router)' | xargs -I {} sh -c "echo {} \`git grep \'{}\' | wc -l\`" | awk '{ if ($2 == "0") print $1 }'
echo Unused controller actions
grep -rE 'public function.*Action\(' src/ | grep Controller | awk '{ gsub(/src\/(Platformd|Velocity42)\//, ""); print }' | awk '{ gsub(/\/Controller\//, ":"); print }' | awk '{ gsub(/Controller\.php: public function /, ":"); print }' | awk -F 'Action' '{ print $1 }' | sort | uniq | xargs -I {} sh -c "echo {} \`git grep -i {} | wc -l\`" | awk '{ if ($2 == "0") print $1 }'
@adfinlay
adfinlay / .vimrc
Created May 9, 2018 10:18
Airline config in .vimrc (Use Fantasque Sans Mono fir PuTTY)
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
let g:airline_powerline_fonts = 1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_symbols.space = "\ua0"
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#show_buffers = 1
@adfinlay
adfinlay / swagger.json
Created April 24, 2018 10:30
swagger.json
{
"openapi" : "3.0.0",
"info" : {
"description" : "Test API for retrieving information",
"version" : "1.0.0",
"title" : "Test API"
},
"paths" : {
"/articles" : {
"get" : {
@adfinlay
adfinlay / swagger.yml
Last active April 24, 2018 13:57
swagger.yml
openapi: 3.0.0
info:
description: Test API for retrieving information
version: "1.0.0"
title: Test API
paths:
/articles:
get:
tags:
- Articles
@adfinlay
adfinlay / non_expiring_redis_keys.sh
Last active March 23, 2017 15:46
List non-expiring (ttl = -1) keys matchg pattern using "safe scan"
#!/bin/bash
if [ "$#" -lt 2 ]
then
echo "Scan keys in Redis matching a pattern using SCAN (safe version of KEYS)"
echo "Usage: $0 <host> [port] [database] [pattern] [count]"
exit 1
fi
host=${1:-}
port=${2:-6379}
@adfinlay
adfinlay / moviebarcode.py
Created November 30, 2016 15:50 — forked from ata4/moviebarcode.py
Python script to create movie barcodes with ffmpeg and imagemagick
#!/usr/bin/python
import sys, subprocess, getopt, os, json
def main(argv):
script_name = os.path.basename(argv[0])
try:
opts, args = getopt.getopt(argv[1:], "sw:h:q:", ["help", "solid-color", "width=", "height=", "samples="])
except getopt.GetoptError as err:
@adfinlay
adfinlay / win7-default-cmd.reg
Created November 15, 2016 13:10
Windows 7 default cmd colours
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Console]
"ColorTable00"=dword:00000000
"ColorTable01"=dword:00800000
"ColorTable02"=dword:00008000
"ColorTable03"=dword:00808000
"ColorTable04"=dword:00000080
"ColorTable05"=dword:00800080
"ColorTable06"=dword:00008080
@adfinlay
adfinlay / solarized-dark.reg
Created November 15, 2016 13:10
Solarized colours for cmd and git bash
Windows Registry Editor Version 5.00
; Registry file that maps the solarized palette to the 16 avaliable colors
; in a Windows command prompt. Note, hex values in the table are RGB but byte
; ordering of a DWORD is BGR, e.g. "ColorTable<##>"=dword:00<B><G><R>
;
; Solarized color table from http://ethanschoonover.com/solarized.
;
; NR cmd.exe PowerShell SOLARIZED HEX DWORD
; -- ------- ----------- --------- ------- --------
@adfinlay
adfinlay / 4-spaces.sublime-macro
Created October 10, 2016 13:47
Sublime Text 3 Macro to set tab spacing to 4
[
{
"args": {
"set_translate_tabs": true
},
"command": "unexpand_tabs"
},
{
"args": {
"setting": "tab_size",