Skip to content

Instantly share code, notes, and snippets.

View CaptainHypertext's full-sized avatar

Jeremy Kastner CaptainHypertext

View GitHub Profile
@CaptainHypertext
CaptainHypertext / spotlight_saver.ps1
Last active March 19, 2019 13:29
Windows Spotlight image saver (powershell)
<#
PowerShell Script that saves Windows Spotlight images to a specified folder. Good for automatic, new wallpaper.
Last revision: 3/17/2019
#>
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing.Image")
$storage_path = "F:\Pictures\Wallpapers\Windows Spotlight"
$assets_path = $env:LOCALAPPDATA + "\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets"
@CaptainHypertext
CaptainHypertext / LargestTables.sql
Created July 18, 2018 21:49
MySQL query to show the largest tables on your server.
/* Taken from https://www.percona.com/blog/2008/02/04/finding-out-largest-tables-on-mysql-server/ */
SELECT CONCAT(table_schema, '.', table_name),
CONCAT(ROUND(table_rows / 1000000, 2), 'M') rows,
CONCAT(ROUND(data_length / ( 1024 * 1024 * 1024 ), 2), 'G') DATA,
CONCAT(ROUND(index_length / ( 1024 * 1024 * 1024 ), 2), 'G') idx,
CONCAT(ROUND(( data_length + index_length ) / ( 1024 * 1024 * 1024 ), 2), 'G') total_size,
ROUND(index_length / data_length, 2) idxfrac
FROM information_schema.TABLES
ORDER BY data_length + index_length DESC
@CaptainHypertext
CaptainHypertext / recording-demo.html
Last active April 23, 2018 15:50
Record audio and play it back with plain html5 and javascript
<html>
<body>
<div>
<audio id="recording-audio" controls style="width: 100%; margin-bottom: 15px;" src="#">
Your browser does not support the audio element.
</audio>
<button id="start-recording-btn" type="button" style="display: none;">
Start Recording
</button>