Skip to content

Instantly share code, notes, and snippets.

@jamescoverdale
jamescoverdale / StorageCheck.sh
Created March 25, 2022 11:42
Simple shell script to check server storage and email current used percentage using sendgrid
#!/bin/bash
CURRENT=$(df / | grep / | awk '{ print $5}' | sed 's/%//g')
EMAILS='[{"to":[{"email":"info@example.com","name":"info"}]'
NAME='ExampleServer'
FROM='info@example.com'
TOKEN='YOUR-SENDGRID-TOKEN-HERE'
CF
CH
GL
HR
LD
LL
NP
SA
SY
# INNER LONDON
E1
E2
E3
E4
E5
E6
E7
E8
E9
@jamescoverdale
jamescoverdale / EnglandPostcodeDistricts.txt
Created November 2, 2020 10:43
List of the English postcode districts
AL
B
BA
BB
BD
BF
BH
BL
BN
BR
@jamescoverdale
jamescoverdale / SendInBlueSendEmailExample.py
Created May 1, 2020 08:53
Example Python code to send a transactional email using the Send In Blue api
import sib_api_v3_sdk
htmlData = '<b>Testing 123</b>'
configuration = sib_api_v3_sdk.Configuration()
configuration.api_key['api-key'] = 'YOUR_API_KEY'
api_instance = sib_api_v3_sdk.SMTPApi(sib_api_v3_sdk.ApiClient(configuration))
send = sib_api_v3_sdk.SendSmtpEmailSender(email = 'hello@sender-email.com')
@jamescoverdale
jamescoverdale / PlotlyOHLC-Rescale-Example.js
Created June 21, 2019 11:03
Snippet of code to show how to resize the yaxis based on the current xoomed view on the ohlc chart. Can easily be changed to handle the other chart types
var myPlot = document.getElementById('plotly-div');
var isUnderRelayout = false;
myPlot.on('plotly_relayout',function(relayoutData){
if(isUnderRelayout != true)
{
isUnderRelayout = true;
// get the start and end dates of current 'view'
@jamescoverdale
jamescoverdale / InputDialog.cs
Created June 15, 2017 13:34
Xamarin MACOS InputDialog
NSAlert inputAlert = new NSAlert() { MessageText = "Enter your license below", AlertStyle = NSAlertStyle.Critical };
inputAlert.AddButton("Enter");
inputAlert.AddButton("Cancel");
NSTextField txt = new NSTextField(new CoreGraphics.CGRect(0, 0, 200, 24));
txt.StringValue = "AAAA-BBBB-CCCC";
inputAlert.AccessoryView = txt;
var result = inputAlert.RunModal();
@jamescoverdale
jamescoverdale / XboxAchievement.js
Created September 5, 2012 14:36
PhantomJS - Xbox Achievement JSON (for your latest game)
/*
This script provides a quick and dirty way of getting your most recent game achievement json data.
This is a lightly modified version of Jabbslad's script found here: https://gist.github.com/1653745
James Coverdale - imjam.es 2012
*/
var fs = require('fs'),