Skip to content

Instantly share code, notes, and snippets.

@BigAl
BigAl / gist:53f500babf1d6d391dd5
Last active August 29, 2015 14:24
Mac brew packer vargrant vb install
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew tap caskroom/cask
$ brew install caskroom/cask/brew-cask
$ brew cask install virtualbox
$ brew cask install vagrant
$ brew cask install packer
@BigAl
BigAl / disk_attach.sh
Last active September 23, 2015 23:38
Create new lvm , mount and transfer data
echo "- - -" > /sys/class/scsi_host/host0/scan
echo "- - -" > /sys/class/scsi_host/host1/scan
echo "- - -" > /sys/class/scsi_host/host2/scan
fdisk /dev/sdb
pvcreate /dev/sdb1
vgcreate vgsyslog /dev/sdb1
lvcreate -n lvsyslog-data -l 100%FREE vgsyslog
--
:backends:
- yaml
:hierarchy:
- defaults
- "%{clientcert}"
- "%{environment}"
- global
:yaml:
@BigAl
BigAl / Find deleted files
Created June 30, 2016 10:45
Handy one liners
Checking for Deleted Files Held Open in UFS File Systems
To 'find' the particular offending process(es) with open but deleted files you can use
find /proc/*/fd -type f -links 0 -exec ls -l {} \;
which looks for files with zero links, i.e. that have been deleted but a running process still has the file open.
Using the PID from the /proc/<PID>/fd/xxxxx names returned you can determine if the process can be restarted without a server reboot.
@BigAl
BigAl / gist:3c376b680c64c3b8fad042808056bad9
Created September 15, 2016 00:29
List and Tag instances in an VPC
VPCID=vpc-f4b2ba96
aws ec2 describe-instances --filters Name=vpc-id,Values=${VPCID} --query 'Reservations[*].Instances[*].[InstanceId,Tags[?Key==`environment`].Value|[0],State.Name,PrivateIpAddress,PublicIpAddress]' --output text | column -t
aws ec2 describe-instances --filters Name=vpc-id,Values=${VPCID} --query 'Reservations[*].Instances[*].[InstanceId]' --output text > instances
aws ec2 create-tags --resources `echo $(cat instances)` --tags Key=environment,Value=test
rm instances
Get Our images
aws ec2 describe-images --region ap-southeast-2 --owners 627242648017 | grep SnapshotId | awk -F'[":]' '{print $5}' | sort | uniq > snaps_in_use_by_images
Get Our volumes
aws ec2 describe-volumes | awk -F'[":]' /snap-/'{print $5}' | sort | uniq > snaps_in_use_by_ec2_volumes
All Snapshot IDs
aws ec2 describe-snapshots --owner-ids 627242648017 | grep SnapshotId | awk -F'[":]' '{print $5}' | sort | uniq > all_snaps
cat snaps_in_use_by_ec2_volumes snaps_in_use_by_images |sort | uniq > all_snaps_in_use
comm -23 all_snaps all_snaps_in_use > snaps_not_inuse
https://www.youtube.com/watch?v=57qIiunuhaQ
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/configuration.md#configuring-the-external-url-for-gitlab
https://blog.mrtrustor.net/post/gitlab-on-k8s/
https://about.gitlab.com/downloads/#centos6
https://github.com/comerford/tf-aws-gitlab/blob/master/main.tf
@BigAl
BigAl / install_puppet.sh
Created May 16, 2017 12:52
Install puppet 4 CentOS
#!/bin/sh
echo "*****************************************"
echo " Installing puppet"
echo "*****************************************"
RELEASEVER=$(rpm -q --qf "%{VERSION}" $(rpm -q --whatprovides redhat-release))
yum install -y https://yum.puppetlabs.com/puppetlabs-release-pc1-el-${RELEASEVER}.noarch.rpm
yum install -y puppet-agent
@BigAl
BigAl / social share
Created July 26, 2014 05:04
social sharing buttons for jekyll
<script type="text/javascript">
window.onload = function(){
var blogDomain = encodeURIComponent("{{ site.url }}");
var pageTitleSpaces = encodeURIComponent("{{ page.title }}") + "&amp;";
var pageID = "{{ page.id }}";
var pageURL = encodeURIComponent(pageID) + "&amp;";
var twitterPartOne = "https://twitter.com/intent/tweet?original_referer=";
var twitterPartTwo = "text=";
var twitterPartThree = "tw_p=tweetbutton&amp;url=";
OSX 10.11.6 packages
curl http://osxapps.itunes.apple.com/apple-assets-us-std-000001/Purple20/v4/dc/94/05/dc940501-f06f-2a91-555e-3dc272653af5/izt4803713449411067066.pkg
curl http://osxapps.itunes.apple.com/apple-assets-us-std-000001/Purple60/v4/45/df/86/45df865d-d24d-01d6-2b2c-c003317293ac/signed.dcr.6112397842917719871.pfpkg
Install command line MAS tool becuase I had problems with the GUI
brew install mas
cd Desktop
mkdir osxapps_local
cd osxapps_local
Put the pkg file here