Skip to content

Instantly share code, notes, and snippets.

@tayles
tayles / video-thumbnail.js
Created August 27, 2023 12:49
Video Thumbnail Download Bookmarklet
// bookmarklet_title: Video Thumbnail
// bookmarklet_about: David Taylor
const canvas = document.createElement('canvas');
const video = document.getElementsByTagName('video')[0];
canvas.width = video.videoWidth;
canvas.height = video.videoHeight;
canvas
.getContext('2d')
.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
@tayles
tayles / gist:1355021
Created November 10, 2011 14:50
Determine linux distro & version
lsb_release -a
# or...
cat /etc/SuSE-release
cat /etc/redhat-release
@tayles
tayles / gist:1339161
Created November 4, 2011 11:39
Oracle foreign key constraints
SELECT
cons.constraint_name AS fk_constraint,
fk.table_name AS fk_table,
fk.column_name AS fk_column,
cons.delete_rule,
'--' AS refers_to,
cons.r_constraint_name AS ref_constraint,
ref.table_name AS ref_table,
ref.column_name AS ref_column
FROM user_constraints cons
@tayles
tayles / gist:1235124
Created September 22, 2011 15:51
Find user-defined objects that require recompilation in Oracle
SELECT *
FROM USER_OBJECTS
WHERE STATUS <> 'VALID'
AND OBJECT_TYPE IN ('VIEW', 'SYNONYM', 'PROCEDURE', 'FUNCTION', 'PACKAGE', 'TRIGGER');
@tayles
tayles / functions.xsl
Created July 6, 2011 11:21
XSL 2.0 recursive functions
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:foo="http://whatever">
<xsl:output method="text"/>
<xsl:variable name="delimiters"> ,."!?()</xsl:variable>
<xsl:function name="foo:substrWordBoundary">
<xsl:param name="inString"/>
@tayles
tayles / gist:1027242
Created June 15, 2011 14:33
View Oracle date columns in the format dd/mm/yyyy hh:mm:ss
ALTER SESSION SET NLS_DATE_FORMAT = 'DD/MM/YYYY HH24:MI:SS';
@tayles
tayles / gist:945512
Created April 27, 2011 23:58
Delete unnecessary files from git commit history
git filter-branch --index-filter "git rm --cached --ignore-unmatch \"misc/*.sql\"" HEAD
git push origin master --force
rm -rf .git/refs/original/
git reflog expire --expire=now --all
git gc --prune=now
@tayles
tayles / lscolours.sh
Created April 13, 2011 10:23
Display current DIRCOLORS
eval $(echo "no:global default;fi:normal file;di:directory;ln:symbolic link;pi:named pipe;so:socket;do:door;bd:block device;cd:character device;or:orphan symlink;mi:missing file;su:set uid;sg:set gid;tw:sticky other writable;ow:other writable;st:sticky;ex:executable;"|sed -e 's/:/="/g; s/\;/"\n/g')
{
IFS=:
for i in $LS_COLORS
do
echo -e "\e[${i#*=}m$( x=${i%=*}; [ "${!x}" ] && echo "${!x}" || echo "$x" )\e[m"
done
}
@tayles
tayles / gist:808839
Created February 3, 2011 00:55
Drupal 7 content find & replace
UPDATE block_custom SET body = REPLACE(body, 'http://static.networkeq.co.uk','http://static01.networkeq.co.uk');
UPDATE field_data_body SET body_value = REPLACE(body_value, 'http://static.networkeq.co.uk','http://static01.networkeq.co.uk');
UPDATE field_data_body SET body_summary = REPLACE(body_summary, 'http://static.networkeq.co.uk','http://static01.networkeq.co.uk');
UPDATE field_revision_body SET body_value = REPLACE(body_value, 'http://static.networkeq.co.uk','http://static01.networkeq.co.uk');
UPDATE field_revision_body SET body_summary = REPLACE(body_summary, 'http://static.networkeq.co.uk','http://static01.networkeq.co.uk');
@tayles
tayles / iTunes.ahk
Created January 8, 2011 15:36
iTunes AutoHotKey global shortcuts
#Include, Lib\COM.ahk
#NoEnv
#SingleInstance, Force
SetBatchLines, -1
OnExit, ExitSub
DetectHiddenWindows, On ; detect window even if it is hidden
Media_Play_Pause::
IfWinExist ahk_class ApolloRuntimeContentWindow ; Pandora
ControlSend ahk_parent, {Space} ; Pandora: Play/Pause