Skip to content

Instantly share code, notes, and snippets.

View markhorrocks's full-sized avatar

Mark Horrocks markhorrocks

  • Australia
View GitHub Profile
@markhorrocks
markhorrocks / test_google_sheets_apiV4.rb
Last active July 23, 2024 14:34
Editing Google Sheets with the Google::Apis::SheetsV4 Ruby Client
#! /usr/bin/ruby
require 'google/apis/sheets_v4'
require 'googleauth'
require 'googleauth/stores/file_token_store'
require 'fileutils'
OOB_URI = 'urn:ietf:wg:oauth:2.0:oob'
APPLICATION_NAME = 'Google Sheets API Test'
@markhorrocks
markhorrocks / gist:0c366f06cdad8ef92871e2591bf8178d
Last active July 6, 2023 19:17
Swift 3 iOS dynamic layout CollectionView cell all in code
This is a collection view of vertically scrolling cells 1/3 high as wide and left hand image 1/3 width of screen with text label 2/3 screen width to the right of the image. This is completely created in code. I created a View Controller on the storyboard as I needed to attach a navgation controller. All you ever ever need to adjust is the imageAspectRatio and te image will always be 1/3 of the width of the cell row.
ViewController code.
import UIKit
let imageAspectRatio : CGFloat = 1.2
@markhorrocks
markhorrocks / check_disk_usage.rb
Last active February 12, 2016 19:23
A Nagios ruby NRPE plugin to check, list and graph all volumes for an Ubuntu server.
#!/usr/bin/env ruby
# you may need to use /usr/bin/ruby
def largest_hash_key(hash)
hash.max_by{|k,v| v}
end
filesystem = %x(df -h)
perfdata = filesystem.split("\n")