Skip to content

Instantly share code, notes, and snippets.

View travi's full-sized avatar

Matt Travi travi

View GitHub Profile
@JonnyWong16
JonnyWong16 / select_tmdb_poster.py
Last active May 19, 2024 16:41
Selects the default TMDB poster for movies in a Plex library if the current poster is from Gracenote.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Description: Selects the default TMDB poster if no poster is selected
or the current poster is from Gracenote.
Author: /u/SwiftPanda16
Requires: plexapi
Usage:
* Change the posters for an entire library:
@jordaaash
jordaaash / .mocharc.json
Created October 25, 2021 01:18
Mocha + TypeScript + ESM
{
"extension": ["ts"],
"node-option": ["experimental-specifier-resolution=node", "loader=ts-node/esm"],
"spec": ["test/**/*.test.ts"]
}
@msimerson
msimerson / get-node-lts.js
Last active February 5, 2021 17:16
Get Node.js LTS versions
#!/usr/bin/env node
const fs = require('fs')
const path = require('path')
const nodeVersionData = require('node-version-data')
const semver = require('semver')
const majorsLatest = {}
const majorsInitial = {}
@kentcdodds
kentcdodds / README.md
Last active March 30, 2024 11:39
user-package-stats

user-package-stats

I was poking around trying to figure out all the packages I have access to publish and got curious. So I write this little script to determine the download stats for all the packages I have publish access to.

Feel free to try it yourself. Just change the username passed to getUserDownloadStats.

By default, the stats are sorted by their average daily downloads (descending). That should give you an idea of the most "popular" package of a given user relative to how long that package has been around.

You can use it with npx like so:

@ifyoumakeit
ifyoumakeit / github-conventional-comments.js
Last active May 14, 2024 08:49
GitHub Conventional Comments (instructions to install in comment below code)
(async function generateReplies(document) {
// https://conventionalcomments.org/#labels
const LABEL = {
praise: "praise",
nitpick: "nitpick",
suggestion: "suggestion",
issue: "issue",
todo: "todo",
question: "question",
thought: "thought",
@coryhouse
coryhouse / PromptOnUnload.jsx
Last active January 7, 2022 11:53
Prompt user when they navigate away
import React, { useEffect } from "react";
import PropTypes from "prop-types";
import { Prompt } from "react-router-dom";
// Prompt the user onbeforeunload or when navigating away by clicking a link
export default function PromptOnUnload({ when, message }) {
const enabled = when;
useEffect(() => {
if (!enabled) return;
const handleBeforeUnload = (event) => {
@Khaledgarbaya
Khaledgarbaya / autonomous.txt
Created February 6, 2020 15:53 — forked from benjamincharity/autonomous.txt
Instructions on how to reset the autonomous desk. This fixes a problem where the desk will not lower (also reportedly fixes incorrectly reported heights).
> Thank you for reaching out to Autonomous! I am sorry to hear that you are having some trouble with your SmartDesk
> but I will be glad to assist. It sounds like your system needs a "hard reset" can I please have you follow these
> steps thoroughly.
Reset Steps:
1. Unplug the desk for 20 seconds. Plug it back in. Wait a full 20 seconds.
2. Press the up and down buttons until the desk lowers all the way and beeps or 20 seconds pass.
3. Release both buttons.
4. Press the down buttons until the desk beeps one more time or 20 seconds pass.
@pvdlg
pvdlg / README.md
Last active December 3, 2019 04:55
semantic-release beta migration

semantic-release beta migration

This is a script to migrate your repository in order to support semantic-release version that includes semantic-release/semantic-release#1368 It will colllect the state information (which version has been released on which channel) based on tags and give you the commadn to run to safe this state with Git note.

This is only useful if were using a previous beta version of semantic-release.

This will not run any command on your repo other than git tag. It will display the command you have to run in your local Git repo to do the migration. Be careful and double check each command before running it!

@Neo23x0
Neo23x0 / sysmon_suspicious_keyboard_layout_load.yml
Last active September 4, 2020 15:41
Sigma Rule to Detect Uncommon Keyboard Layout Loads in Your Organisation
title: Suspicious Keyboard Layout Load
description: Detects the keyboard preload installation with a suspicious keyboard layout, e.g. Chinese, Iranian or Vietnamese layout load in user session on systems maintained by US staff only
references:
- https://renenyffenegger.ch/notes/Windows/registry/tree/HKEY_CURRENT_USER/Keyboard-Layout/Preload/index
author: Florian Roth
date: 2019/10/12
logsource:
product: windows
service: sysmon
definition: 'Requirements: Sysmon config that monitors \Keyboard Layout\Preload subkey of the HKLU hives - see https://github.com/SwiftOnSecurity/sysmon-config/pull/92/files'
@gr2m
gr2m / using_ecmascript_modules_for_octokit.md
Last active October 9, 2019 01:53
Living document to make the Octokit JS libraries (https://github.com/octokit?utf8=%E2%9C%93&q=.js&type=&language=) work with ECMAScript Modules, Common JS and modern browsers

My usecase: Universal JavaScript libraries for GitHub's APIs for Node.js and modern browsers.

All libraries are written in Typescript, so a build step is necessary which makes it easier to seperate the source code structure from the distribution code structure. I rely heavily on pika.dev for creating browser bundles and distributing them via their CDN. Example: https://github.com/octokit/request.js/#usage.

I use @pika/pack to create a ./pkg folder with multiple distributions right before publishing to npm. Example: https://unpkg.com/browse/@octokit/request@5.1.0/

Currently, the dist-web/ folder is the ECMAScript Module export, it's referenced using the "module" key in its package.json. The dist-node/ folder is referenced using the "main" key in its package.json.

Besides the differentiation of common