Skip to content

Instantly share code, notes, and snippets.

@chappy84
chappy84 / convert_stravactivity_to_gpx
Last active January 15, 2023 05:25
Quick and dirty PHP script to convert .stravactivity file to basic gpx xml
#!/usr/bin/env php
<?php
function dateInFormat($timestamp)
{
return date('Y-m-d\TH:i:s\Z', $timestamp);
}
function latLongInFormat($reference)
{
return round((float) $reference, 6);
@chappy84
chappy84 / githubStarred.php
Last active November 20, 2016 23:31
Github Starred Dates - displays when you starred repos, which seems to have disappeared from GitHub's UI :(
<?php
function errorAndDie($message) {
echo $message . PHP_EOL;
die(1);
}
$url = 'https://api.github.com/user/starred';
do {
@chappy84
chappy84 / Dockerfile
Last active April 18, 2024 16:31
Packt Pub Downloader - Quick hacky script to download all your e-books from packtpub.com. This may not always work, they may change their api calls etc.
FROM php:cli-alpine
RUN mkdir /opt/ppd /mnt/ebooks
COPY packtPubDownloader.php /opt/ppd/
RUN sed -e "s#saveParentDir = __DIR__;#saveParentDir = '/mnt';#" -i /opt/ppd/packtPubDownloader.php
VOLUME /mnt
@chappy84
chappy84 / Dockerfile
Last active February 20, 2020 09:19
Velominati Slack Bot - Names the rule that someone is quoting in slack (Quickly hacked together script)
FROM python:2-alpine3.7
ARG slack_api_token
ENV SLACK_API_TOKEN $slack_api_token
WORKDIR /local/bot
COPY velominati-slack-bot.py ./
RUN apk update && \
const functionsToOverride = ['overrideMimeType', 'send'];
functionsToOverride.forEach(function(fnName) {
window.XMLHttpRequest.prototype[fnName] = new Proxy(window.XMLHttpRequest.prototype[fnName], {
apply: (target, thisArg, argumentsList) => {
console.log(fnName + ' arguments', argumentsList);
thisArg[fnName + 'Args'] = [...argumentsList];
const retVal = target.apply(thisArg, argumentsList);
console.log(fnName + ' retVal', retVal);
return retVal;
}
@chappy84
chappy84 / xbrowsersync_api_centos.sh
Last active October 8, 2022 10:01
Setup xBroswerSync API on a CentOS box
#!/bin/sh
####################################################################################################
#
# Setup xBrowserSync API on CentOS
#
# Copyright (c) 2020, Tom Chapman (https://tom-chapman.uk)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are
@chappy84
chappy84 / linode-longview-centos8.sh
Created June 5, 2020 20:44
Install script for Linode's Longview on CentOS 8 .... until they stop supporting it completely
#!/bin/sh
####################################################################################################
#
# Install Linode's LongView on CentOS 8
#
# Copyright (c) 2020, Tom Chapman (http://tom-chapman.uk)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are