Skip to content

Instantly share code, notes, and snippets.

@pmcjury
pmcjury / ls_head_xargs_rm
Created December 3, 2014 16:12
Remove N oldest files from a directory
ls -1tr | head -n -10 | xargs -d '\n' rm -f
@pmcjury
pmcjury / lisyMysqlUsers.sql
Created April 30, 2014 17:30
List Mysql Users
SELECT User FROM mysql.user;
@pmcjury
pmcjury / commit-msg
Last active January 4, 2016 17:18
JIRA Issue Key in commit message hook and message length check
#!/usr/bin/env ruby
class Ui
CLEAR = `tput sgr0`
BOLD = `tput bold`
RED =`tput setaf 1`
YELLOW =`tput setaf 3`
def self.error(message)
@pmcjury
pmcjury / Thorfile
Last active January 3, 2016 15:09
Thor Chef Test Helpers
# encoding: utf-8
require 'bundler'
require 'bundler/setup'
require 'berkshelf/thor'
require 'fileutils'
require 'json'
require 'chef/encrypted_data_bag_item'
require 'chef/knife'
require 'tempfile'
@pmcjury
pmcjury / pub-priv-key.sh
Last active December 18, 2015 05:19
Public Private Key Pair
# see if you have any keys already there if not do the next line, else skip to copy
cd ~/.ssh
# generate keys
ssh-keygen -t rsa -C "your_email@example.com"
# Option 1: copy keys via ssh-copy-id script
ssh-copy-id <username>@<host>
# Option 2: copy keys manually
@pmcjury
pmcjury / rvm_rvmrc_creation.sh
Created April 15, 2013 17:36
RVM rvmrc creation
rvm --rvmrc --create {ruby_version}@{project_name}
@pmcjury
pmcjury / gist:4957050
Last active December 13, 2015 18:38
SSH into a vagrant vm with the default config
ssh vagrant@127.0.0.1 -p 2222
vagrant@127.0.0.1\'s password: # pasword is vagrant
@pmcjury
pmcjury / removeDotsvn.sh
Last active December 11, 2015 16:08
remove .svn
find . -type d -name .svn -exec rm -rf {} \;
@pmcjury
pmcjury / tputs.bash
Last active November 17, 2023 04:26
Add some color to scripts with tputs assigned to variable, also read some true, false, yes , or no inputs from user and assign to a variable
#!/bin/bash
bold=`tput bold`
black=`tput setaf 0` # 0 Black
red=`tput setaf 1` # 1 Red
green=`tput setaf 2` # 2 Green
yellow=`tput setaf 3` # 3 Yellow
blue=`tput setaf 4` # 4 Blue
magenta=`tput setaf 5` # 5 Magenta
cyan=`tput setaf 6` # 6 Cyan