This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Album of the Year Last.fm integration | |
// @namespace https://www.albumoftheyear.org/ | |
// @version 0.2.1 | |
// @description Adds link to a user's scrobble pages for artist and album names | |
// @author tomc.dev | |
// @match https://www.albumoftheyear.org/* | |
// @license MIT | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=albumoftheyear.org | |
// @downloadURL https://gist.github.com/chappy84/86eb4aeeca7fff5f5ae79ee451ecc4cd/raw/albumoftheyear.org-last.fm-integration.user.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 && \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM php:cli-alpine | |
RUN mkdir /opt/ppd /mnt/ebooks | |
COPY packtPubDownloader.php /opt/ppd/ | |
VOLUME /mnt | |
WORKDIR /mnt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function errorAndDie($message) { | |
echo $message . PHP_EOL; | |
die(1); | |
} | |
$url = 'https://api.github.com/user/starred'; | |
do { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP PROCEDURE IF EXISTS pivot_user_preferences; | |
DELIMITER $$ | |
CREATE PROCEDURE pivot_user_preferences(IN user_id INT) | |
BEGIN | |
DECLARE done INT DEFAULT FALSE; | |
DECLARE definition_label CHAR(255); | |
DECLARE label_cursor CURSOR FOR SELECT DISTINCT label FROM example_db.user_preferences; | |
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$myConn = new PDO( | |
'mysql:host=localhost;dbname=dbname', | |
'username', | |
'password' | |
); | |
$myConn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | |
$multiSqlStatement = ' | |
INSERT INTO users (username) VALUES (:username); |
NewerOlder