Skip to content

Instantly share code, notes, and snippets.

View tobek's full-sized avatar

Toby Fox tobek

View GitHub Profile
@tobek
tobek / get-image-urls.js
Last active May 18, 2024 14:43
Save images from chrome inspector/dev tools network tab
/* open up chrome dev tools (Menu > More tools > Developer tools)
* go to network tab, refresh the page, wait for images to load (on some sites you may have to scroll down to the images for them to start loading)
* right click/ctrl click on any entry in the network log, select Copy > Copy All as HAR
* open up JS console and enter: var har = [paste]
* (pasting could take a while if there's a lot of requests)
* paste the following JS code into the console
* copy the output, paste into a text file
* open up a terminal in same directory as text file, then: wget -i [that file]
*/
@tobek
tobek / gist:9edceef229e5ad5e7ed1
Last active August 29, 2015 14:06
Unfurler QS blacklist checker
LEGEND:
= Match
_ No canonical URL found in either
~ Both requests failed
X Mismatch
========================================================================X=XXXX====================== ✔ {"domain":"www.marketwatch.com"}
======_===============~===========================================_=====_=~_=================_=====X ✔ {"domain":"nymag.com"}
____________________________________________________________________________________________________ ✖ {"domain":"luufy.com"}
===__________=====X====_===========___==============_====_______===__===============_=____=_======== ✔ {"domain":"www.zazzle.com"}
@tobek
tobek / fadeshow.php
Created July 26, 2015 05:21
fadeshow
<?php
$image_dir = '/wp-content/uploads/fadeshow/';
$images = array(
'pillow-pile.jpg',
'gold-couch.jpg',
'shade-and-swag.jpg',
'barrel-chair.jpg',
'roman-shades.jpg',
'blue-sofa.jpg',
@tobek
tobek / grunt-aws-s3.js
Created January 10, 2016 22:23
basic config for grunt-aws-s3 task
// using https://github.com/MathieuLoutre/grunt-aws-s3
aws_s3: {
options: {
accessKeyId: '<%= aws.key %>',
secretAccessKey: '<%= aws.secret %>',
// putting no region makes it default to US Standard
// debug: true, // do a dry run
uploadConcurrency: 5
},
@tobek
tobek / youtube-upload.html
Created March 25, 2016 02:39
YouTube API v3 upload video and set snippet etc.
<!-- More info at http://stackoverflow.com/questions/25595930/youtube-api-v3-over-http-post-cant-set-snippet-while-uploading-a-video-title/ -->
<form id="upload-yt-video" action="https://www.googleapis.com/upload/youtube/v3/videos?part=snippet&access_token=YOUR_TOKEN_HERE" method="post" enctype="multipart/form-data">
<input type="text" name="title" placeholder="Video title">
<textarea name="description" placeholder="Video description"></textarea>
<input type="file" accept="video/*" name="videoFile">
<input type="submit" value="Upload Video">
</form>
<!-- load jQuery -->
@tobek
tobek / vice-mag-headline-generator.js
Created July 15, 2016 20:30
@deadlydizzle's Vice Magazine Headline Generator script
/* Vice Magazine Headline Generator script
Author: David Alexander (ddly.co / @deadlydizzle)
Version: 1.0 September 1, 2014
License: GNU General Public License, version 3.0 (GPLv3)
*/
// Tell JSLint's 'defined but never used' error to take a hike
/* exported setHeadline */
@tobek
tobek / tgp.conf
Created December 3, 2016 04:25
PHP-FPM config for TGP on Linux
; Start a new pool named 'www'.
; the variable $pool can we used in any directive and will be replaced by the
; pool name ('www' here)
[thegenerationsproject.info]
; Per pool prefix
; It only applies on the following directives:
; - 'access.log'
; - 'slowlog'
; - 'listen' (unixsocket)
@tobek
tobek / memory-alert.sh
Created December 9, 2016 01:47
Linux daemon for alerting you if you're running out of memory
#!/bin/bash
# Minimum available memory limit, MB
THRESHOLD=1024
# Check time interval, sec
INTERVAL=60
while :
do
@tobek
tobek / habitica-tags-userscript.js
Created January 26, 2017 00:06
Habitica Tag Visibility Userscript
// ==UserScript==
// @name Habitica Tag Visibility
// @namespace tobek-habitica
// @version 0.1
// @description Makes tags visible in the name of the task, without having to hover over the tags icon. Tags are shown as "[tag1][tag2][...] Task name...". This is a total hack and would be much better as part of official Habitica codebase but that's more work and discussion than the 10m I spent on this.
// @author Tobek
// @match https://habitica.com/*
// @grant none
// ==/UserScript==
@tobek
tobek / lastfm-remove-duplicates.js
Last active March 7, 2018 17:20 — forked from sk22/lastfm-remove-duplicates.js
Last.fm duplicate scrobble deleter
var dupesFound = 0;
var elements = Array.from(document.querySelectorAll('.js-link-block'))
elements.map(function (element) {
var nameElement = element.querySelector('.chartlist-name')
return nameElement && nameElement.textContent.replace(/\s+/g, ' ').trim()
}).forEach(function (name, i, names) {
if (name !== names[i + 1]) return
var deleteButton = elements[i].querySelector('[data-ajax-form-sets-state="deleted"]')
if (deleteButton) {
dupesFound++;