Skip to content

Instantly share code, notes, and snippets.

View thomaswhite's full-sized avatar

Thomas White thomaswhite

View GitHub Profile

Last updated: 2017-03-18

Searching for Files

Find images in a directory that don't have a DateTimeOriginal

exiftool -filename -filemodifydate -createdate -r -if '(not $datetimeoriginal) and $filetype eq "JPEG"' .

###Output photos that don't have datetimeoriginal to a CSV### Note this can take a long time if you have a lot of jpgs

@caseywatts
caseywatts / bookmarkleting.md
Last active May 3, 2025 14:47
Making Bookmarklets

This is one chapter of my "Chrome Extension Workshops" tutorial, see the rest here: https://gist.github.com/caseywatts/8eec8ff974dee9f3b247

Unrelated update: my book is out! Debugging Your Brain is an applied psychology / self-help book

Making Bookmarklets

I'm feeling very clever. I've got this sweet line of javascript that replaces "cloud" with "butt". My mom would LOVE this, but she doesn't computer very well. I'm afraid to show her the Developer Console and have her type/paste this in. But she IS pretty good at bookmarks, she knows just how to click those!

A bookmark normally takes you to a new web page. A bookmarklet is a bookmark that runs javascript on the current page instead of taking you to a new page. To declare that it is a bookmarklet, the "location" it points to starts with javascript:.

@Nilpo
Nilpo / Using Git to Manage a Live Web Site.md
Last active April 24, 2025 23:08
Using Git to Manage a Live Web Site

Using Git to Manage a Live Web Site

Overview

As a freelancer, I build a lot of web sites. That's a lot of code changes to track. Thankfully, a Git-enabled workflow with proper branching makes short work of project tracking. I can easily see development features in branches as well as a snapshot of the sites' production code. A nice addition to that workflow is that ability to use Git to push updates to any of the various sites I work on while committing changes.

Contents

@2E0PGS
2E0PGS / linux-usb-file-copy-fix.md
Last active February 20, 2025 20:55
Fix Ubuntu and other Linux slow/hanging file copying via USB.

If your running a x64 bit Ubuntu or other Linux and find USB transfers hang at the end apply this fix:

echo $((16*1024*1024)) > /proc/sys/vm/dirty_background_bytes
echo $((48*1024*1024)) > /proc/sys/vm/dirty_bytes

I suggest you edit your /etc/rc.local file to make this change persistant across reboots.

sudo nano /etc/rc.local

@gurisko
gurisko / functionName.js
Last active May 11, 2024 05:41
[NodeJS] Get the current function name or any other function while using strict mode
'use strict';
const findFirstOccurrence = (string, searchElements, fromIndex = 0) => {
let min = string.length;
for (let i = 0; i < searchElements.length; i += 1) {
const occ = string.indexOf(searchElements[i], fromIndex);
if (occ !== -1 && occ < min) {
min = occ;
}
}
@glasslion
glasslion / vtt2text.py
Last active March 9, 2025 02:54
This script convert youtube subtitle file(vtt) to plain text.
"""
Convert YouTube subtitles(vtt) to human readable text.
Download only subtitles from YouTube with youtube-dl:
youtube-dl --skip-download --convert-subs vtt <video_url>
Note that default subtitle format provided by YouTube is ass, which is hard
to process with simple regex. Luckily youtube-dl can convert ass to vtt, which
is easier to process.
@akash-coded
akash-coded / web-scraping-boilerpy.md
Last active April 25, 2025 13:34
Text extraction from websites, or Web Mining, is a major area of interest in today's connected world. Extract text content from web pages with Python tools. Some of the tools mentioned here have a more focussed approach on main text extraction wherea

1. Using BoilerPy3, a native Python port of Christian Kohlschütter's Boilerpipe for automatically extracting main textual content of a webpage based on shallow text features. It gives us the page title and it's contents

!pip install boilerpy3
from boilerpy3 import extractors

extractor = extractors.CanolaExtractor()

doc = extractor.get_doc_from_url('https://www.newsrain.in/petrol-diesel-prices/Odisha')
page_title = doc.title
@kabili207
kabili207 / Rclone systemd service.md
Last active May 16, 2025 18:49
Rclone systemd user service

rclone systemd service

Preparation

This service will use the same remote name you specified when using rclone config create. If you haven't done that yet, do so now.

Next, create the mountpoint for your remote. The service uses the location ~/mnt/<remote> by default.

mkdir ~/mnt/dropbox
@yusufkandemir
yusufkandemir / 1_quasar-sentry-firebase-deployment.yml
Last active March 11, 2024 10:53
Github Actions: Deploy a Quasar Framework app to Firebase Hosting and create a Sentry release
# .github/workflows/hosting.yml
name: Hosting
on:
# You can use other strategies here, check: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#on
push:
branches:
- production
jobs:
@jaredyam
jaredyam / remove-srt-duplications.py
Last active October 18, 2024 11:39
Remove duplicate subtitles in a .srt file
"""Remove duplicate subtitles in a .srt file.
- What does the standard srt file look like?
- See https://www.3playmedia.com/2017/03/08/create-srt-file/
- What does the duplicate subtitle look like?
- The duplicate subtitle is something like the addition of its previous and next subtitle.
- Which match pattern has been used in this script?
- Line 85, 87
- What does the output srt file look like?
- [original_file_name]_changed.srt