Skip to content

Instantly share code, notes, and snippets.

View crablab's full-sized avatar

Hugh Wells crablab

View GitHub Profile
@crablab
crablab / pd-event-rule-migration.py
Created January 24, 2024 09:54
Migrate PagerDuty Event Rules to Event Orchestration in bulk. See: https://support.pagerduty.com/docs/migrate-to-event-orchestration
import os
import requests
import argparse
import logging
PD_KEY = os.getenv('PD_KEY')
parser = argparse.ArgumentParser(
description='Migrate event rules for all services in a PD account')
parser.add_argument('--include', dest='include',
@crablab
crablab / telegrafNginxConfig
Created January 4, 2019 19:33
A telegraf config to be used with Grafana dashboard 5063. Requires additional config on server
# OUTPUTS
[outputs]
[outputs.influxdb]
# The full HTTP endpoint URL for your InfluxDB instance
url = "http://192.168.1.67:8086"
# The target database for metrics. This database must already exist
database = "nginx"
# PLUGINS
@crablab
crablab / mythic.php
Created May 10, 2018 20:06
A solution for a coding challenge
<?php
/*
Uses: https://gist.github.com/ircmaxell/1232629
*/
require_once 'Math.php';
$math = new Math();
$html = file_get_contents("http://sphinx.mythic-beasts.com/cgi-bin/job.pl");
preg_match("/.+?(?=,)/", $html, $find_equation);

Keybase proof

I hereby claim:

  • I am crablab on github.
  • I am crablab (https://keybase.io/crablab) on keybase.
  • I have a public key whose fingerprint is F85E A965 6A23 203A C471 B749 AD59 5409 33CE 63DC

To claim this, I am signing this object:

@crablab
crablab / RailReferences.csv
Last active April 12, 2022 14:16
ATCO, TIPLOC, CRS, NAME,"StationNameLang",GridType, Easting, Northing, Creation, Modification, data from https://data.gov.uk/dataset/naptan
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 8.
"AtcoCode","TiplocCode","CrsCode","StationName","StationNameLang","GridType","Easting","Northing","CreationDateTime","ModificationDateTime","RevisionNumber","Modification"
"9100PENZNCE","PENZNCE","PNZ","Penzance Rail Station","","U",147588,30599,"2003-11-04T00:00:00","2011-09-30T14:47:28",2,"rev"
"9100STIVES","STIVES","SIV","St Ives (Cornwall) Rail Station","","U",151947,40127,"2005-04-04T00:00:00","2011-09-30T14:47:28",4,"rev"
"9100CARBISB","CARBISB","CBB","Carbis Bay Rail Station","","U",152930,38745,"2003-11-04T00:00:00","2011-09-30T14:47:28",5,"rev"
"9100STERTH","STERTH","SER","St Erth Rail Station","","U",154150,35730,"2003-11-04T00:00:00","2007-02-13T17:06:21",3,"rev"
"9100LELANTS","LELANTS","LTS","Lelant Saltings Rail Station","","U",154430,36640,"2003-11-04T00:00:00","2011-09-30T14:47:28",2,"rev"
"9100LELANT","LELANT","LEL","Lelant Rail Station","","U",154770,37220,"2003-11-04T00:00:00","2007-02-13T17:06:21",3,"rev"
"9100HAYLE","HAYLE","HYL","Hayle Rail Station","","U",155970,37325,"2003-11-04T00:00:0
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQENBFpcu5YBCACjKQPCAxYhriKf88MMJj1/lFZR4d5fnnMwoEla+18HNhPfHWBy
G1ynj5Qt+jR/HuDYVfgmNKrjKd9VozdQWIOpWHlmXdxA+3DLpawm6fmZzwtWZBfn
BVGfSRt9vaKzJjOtL/Q6vzIutkwu3mwnOAV31tkubXmvd6r/13Sv+9uWXxc11usN
puR29Mv7/VkB2g9LcGkk9HW6A5m3NOINvi99tA9LoAljw1am01Pc9VaBpGwP2l1H
dxc59nxYZCG9FfeOKTp/vZmEXlBTlNslDomBZzECfGFIbWhFB78nGyfTWwL1a+6e
3libs/DSz3L3Dnx/lOwKuSYJ2FLxZIQslak3ABEBAAG0H0h1Z2ggV2VsbHMgPGh1
Z2hAY3JhYmxhYi5jby51az6JATcEEwEIACEFAlpcu5YCGwMFCwkIBwIGFQgJCgsC
BBYCAwECHgECF4AACgkQrVlUCTPOY9wbTgf+PQFvUFzAKiZNYcuQu/FaF+SdcmIq
@crablab
crablab / keyword_search.php
Last active September 25, 2017 13:37
HTM Keyword Search Engine Over Text
<?php
/*
NOTES:
You need to buy a phone number from Nexmo and set up a webhook to call back to whereever this is hosted.
You also need to a Majestic API key
*/
//CHANGE THESE VALUES (these keys are not live - they are included for reference)
define("MAJESTIC_KEY", "E75625C6856B9607AFA4232FE77E3C9C");
define("NEXMO_KEY", "266bf1aa");
@crablab
crablab / twitter_clenser.py
Last active April 8, 2017 14:30 — forked from yanofsky/LICENSE
A script to download all users tweets, search them for expletives and inappropriate language and delete the offending posts (particularly useful for those applying to university/college or a new job). Download code forked from https://gist.github.com/yanofsky/5436496
'''
Compiled by @crablabuk using Tweet download script https://gist.github.com/yanofsky/5436496
Free to distribute, edit and modify with no restrictions
---
https://gist.github.com/crablab/4aa4cf561c430446c762a1e08862f5d6
'''
import tweepy #https://github.com/tweepy/tweepy
import csv
#API credentials