Skip to content

Instantly share code, notes, and snippets.

View markjfletcher's full-sized avatar

Mark Fletcher markjfletcher

View GitHub Profile
@markjfletcher
markjfletcher / query.sh
Created November 17, 2020 19:47
AWSCLI - Get back the latest Windows AMI
aws ec2 describe-images --owners amazon --filters "Name=name,Values=Windows_Server-2016-English-Core-Base*" --query 'Images[*].[ImageId, Name]'
@markjfletcher
markjfletcher / main.ps1
Created November 17, 2020 19:46
Using IISAdministration Powershell Module to change an Application Pool
Import-Module IISAdministration
$timeSpan = New-TimeSpan -Minutes 0
$manager = Get-IISServerManager
$pool = $manager.ApplicationPools["$poolName"]
$pool.ChildElements["processModel"].Attributes["idleTimeout"].Value = $timeSpan
$manager.CommitChanges()
VAR="foo.gif"
echo "File name - ${VAR%.*}"
echo "File extension - ${VAR#*.}"
@markjfletcher
markjfletcher / Updating GO
Created December 4, 2015 19:52
Workflow for updating GO 1.5.x using GVM
gvm install go1.4
gvm use go1.4
export GOROOT_BOOTSTRAP=$GOROOT
gvm install go1.5
@markjfletcher
markjfletcher / addusers.sh
Created June 19, 2015 19:07
Simple Add User and Set Password Script
#!/bin/bash
clear
users=(user1:pass user2:pass user3:pass)
for user in "${users[@]}"
do
password=${user##*:}
username=${user%:*}
echo Adding $username with Password $password
@markjfletcher
markjfletcher / puma.service
Created April 17, 2015 08:14
Rough systemd service for running puma
[Unit]
Description=Puma application server
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
User=rails
WorkingDirectory=/vagrant/testApp
PIDFile=/vagrant/testApp/shared/pids/puma.pid
ExecStart=/bin/bash -lc 'bundle exec puma -C config/puma.rb'
Restart=always
@markjfletcher
markjfletcher / update.py
Created April 2, 2014 18:46
Python Library Checker
## {{{ http://code.activestate.com/recipes/577708/ (r1)
#!/usr/bin/env python
import xmlrpclib
import pip
pypi = xmlrpclib.ServerProxy('http://pypi.python.org/pypi')
for dist in pip.get_installed_distributions():
available = pypi.package_releases(dist.project_name)
if not available:
@markjfletcher
markjfletcher / .bashrc
Last active August 29, 2015 13:57
Marks .bashrc
# Show git branch when in a git repo
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/[\1]/'
}
export PS1='\[\033[0;32m\]\u@\h\[\033[0;36m\]\w\[\033[0;33m\]$(parse_git_branch)\[\033[00m\]: '
@markjfletcher
markjfletcher / .conkyrc_good
Created February 11, 2014 02:45
.conkyrc debian
# Conky, a system monitor, based on torsmo
#
# Any original torsmo code is licensed under the BSD license
#
# All code written since the fork of torsmo is licensed under the GPL
#
# Please see COPYING for details
#
# Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
# Copyright (c) 2005-2010 Brenden Matthews, Philip Kovacs, et. al. (see AUTHORS)