Skip to content

Instantly share code, notes, and snippets.

View t0mtaylor's full-sized avatar
🏠
Working from home

Tom Taylor t0mtaylor

🏠
Working from home
View GitHub Profile
@ivan
ivan / make-audio-feed.sh
Last active February 3, 2024 13:19
Script to generate a Podcasts/Overcast-compatible RSS feed for audio files on your own web server
#!/usr/bin/env bash
# Generates an RSS feed for a list of audio files, for consumption by Overcast
# and other podcast players.
#
# Usage: make-audio-feed TITLE BASE_URL FILE...
# Example: (cd directory && make-audio-feed 'My Audio Files' 'https://your.server/directory/' * > .feed.rss)
set -eu -o pipefail
@nginx-gists
nginx-gists / banned.html
Last active November 9, 2023 09:43
Dynamic IP Denylisting with NGINX Plus and fail2ban
<!DOCTYPE html>
<html>
<head>
<title>Banned</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
@manuhabitela
manuhabitela / _grid.scss
Last active January 11, 2021 14:15
Making the Bootstrap grid with Susy and sass-mq
// this is (a start of) an example of a Susy+mq() setup that mimics bootstrap grid.
// I work on multiple bootstrap-based projects.
// I want to stop using grid classes in the markup, and start using mixins with susy and sass-mq.
// Since the project is heavily tied to the bootstrap grid, I want to have the exact same behavior
// between bootstrap classes (old code) and susy mixins (new code).
// all the grid classes generated below are here to ease up testing.
// required: susy + sass-mq
app.directive('infiniteScroll', [
'$rootScope', '$window', '$timeout', function($rootScope, $window, $timeout) {
return {
link: function(scope, elem, attrs) {
var checkWhenEnabled, handler, scrollDistance, scrollEnabled;
$window = angular.element($window);
elem.css('overflow-y', 'scroll');
elem.css('overflow-x', 'hidden');
elem.css('height', 'inherit');
scrollDistance = 0;
@chales
chales / db-connect-test.php
Last active June 3, 2023 01:01
Script for a quick PHP MySQL DB connection test.
<?php
# Fill our vars and run on cli
# $ php -f db-connect-test.php
$dbname = 'name';
$dbuser = 'user';
$dbpass = 'pass';
$dbhost = 'host';
$connect = mysql_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'");
@kenmickles
kenmickles / update-digitial-ocean-dns.sh
Last active April 11, 2022 19:47
Shell script to dynamically update a Digital Ocean DNS record
#!/bin/bash
TOKEN="Get token from https://cloud.digitalocean.com/settings/applications"
DOMAIN=example.com
RECORD_ID=12345
IP=`curl -s checkip.dyndns.org | grep -Eo '[0-9\.]+'`
# to get record id:
# curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $TOKEN" "https://api.digitalocean.com/v2/domains/$DOMAIN/records"
/**
* Hide the addressbar on ios & android devices
* https://gist.github.com/yckart/5609969
*
* Based on the work from Nate Smith
* @see https://gist.github.com/nateps/1172490
*
* Copyright (c) 2013 Yannick Albert (http://yckart.com)
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php).
* 2013/07/10
@xseignard
xseignard / merge_lcov
Last active June 22, 2022 12:47
Merge lcov files
#!/bin/bash
while read FILENAME; do
LCOV_INPUT_FILES="$LCOV_INPUT_FILES -a \"$FILENAME\""
done < <( find $1 -name lcov.info )
eval lcov "${LCOV_INPUT_FILES}" -o $1/$2
@betweenbrain
betweenbrain / gist:5405671
Created April 17, 2013 16:26
Use cURL and SimpleXML to retrieve and parse Wordpress RSS feed
<?php
$curl = curl_init();
curl_setopt_array($curl, Array(
CURLOPT_URL => 'http://blogs.guggenheim.org/map/feed/',
CURLOPT_USERAGENT => 'spider',
CURLOPT_TIMEOUT => 120,
CURLOPT_CONNECTTIMEOUT => 30,
CURLOPT_RETURNTRANSFER => TRUE,
@jcanfield
jcanfield / msie-vmwarefusion-osx.bash
Created April 3, 2013 02:56
Download the latest VMWare Fusion images from Modern.IE for Internet Explorer Testing. This bash script is primitive and simple. Anybody who would like to expand on this is more than welcome to.
#!/bin/bash
# Download all VMWare Fusion machines from Modern.IE Website to test your Website/Web Application in Microsoft Internet Explorer on Mac OSX. All VM's and other VM's for Windows and Linux and other Virtual Manager's such as VirtualBox can be found at http://modern.ie/
# Don't have cURL or want to learn more, visit http://curl.haxx.se/.. are you really a Developer? First part of that sentence comes from the MS site.
read -p "--> Downloading Internet Explorer 6-10 on Windows XP/7/8 Appliances for VMWare Fusion. Large downloads ahead. (Press Enter to continue)."
echo "--> Download Internet Explorer 6 on Microsoft Windows XP Appliance for VMWare Fusion."
curl --progress-bar -O "http://virtualization.modern.ie/vhd/IEKitV1_Final/VMWare_Fusion/IE6_XP/IE6.XP.For.MacVMware.sfx"
echo "--> Download Internet Explorer 8 on Microsoft Windows XP Appliance for VMWare Fusion."