Skip to content

Instantly share code, notes, and snippets.

View sscotth's full-sized avatar
🏠
𝄆 🍽 🛌 👨‍💻 𝄇

Scott Humphries sscotth

🏠
𝄆 🍽 🛌 👨‍💻 𝄇
View GitHub Profile
@sscotth
sscotth / keystroke the clipboard extended.workflow
Last active January 2, 2024 12:12
Paste as keystrokes (macOS)
View keystroke the clipboard extended.workflow
# Why?
# To paste text into windows that normally don't allow it or have access to the clipboard.
# Examples: Virtual machines that do not yet have tools installed, websites that hijack paste
#
# Extended vs Simple?
# * Includes an initial delay to allow you to change active windows
# * Adds small delay between keypresses for slower responding windows like SSH sessions
# * Better handling of numbers
# * VMWare bug fix
#
@sscotth
sscotth / noVNCCopyPasteProxmox.user.js
Last active October 7, 2023 07:01 — forked from amunchet/noVNCCopyPasteProxmox.user.js
Copy/Paste for noVNC Proxmox
View noVNCCopyPasteProxmox.user.js
// ==UserScript==
// @name noVNC Paste for Proxmox
// @namespace http://tampermonkey.net/
// @version 0.3
// @description Pastes text into a noVNC window (for use with Proxmox specifically)
// @author Chester Enright
// @match https://*
// @include /^.*novnc.*/
// @require http://code.jquery.com/jquery-3.3.1.min.js
// @grant none
@sscotth
sscotth / logoutAllUsers.sh
Last active August 5, 2022 20:06
AWS Cognito logout all users of user pool
View logoutAllUsers.sh
#!/bin/sh
# REQUIRES 'jq' TO BE INSTALLED (`brew install jq`)
# Combines two aws-cli cognito commands, `list-users` and `admin-user-global-sign-out`.
# * aws cognito-idp list-users --region ${REGION} --user-pool-id ${USER_POOL_ID}
# * aws cognito-idp admin-user-global-sign-out --region ${REGION} --user-pool-id ${USER_POOL_ID} --username ${USERNAME}
# However, the `list-users` command may be paginated.
# Used a pagination loop based on `https://stackoverflow.com/a/68809399`.
View router.js
// <Routes>
// <Route path="/" element={<RequireAuth><Dashboard /></RequireAuth>}>
// <Route path="about" element={<AboutPage />} />
// </Routes>
import { Auth } from 'aws-amplify'
import { Navigate } from 'react-router-dom'
const RequireAuth = ({ children }) => {
const [loading, setLoading] = React.useState(true)
View tesmart.yaml
kvmd:
gpio:
drivers:
tes:
type: tesmart
host: 10.10.1.10
port: 5000
scheme:
server0_led:
driver: tes
@sscotth
sscotth / test.js
Created March 21, 2019 19:45
mdx Elements
View test.js
const assert = require('assert')
const mdx = require('@mdx-js/mdx')
const text = 'foo'
const expected = el =>
`\n\nconst layoutProps = {\n \n};\nexport default class MDXContent extends React.Component {\n constructor(props) {\n super(props)\n this.layout = null\n }\n render() {\n const { components, ...props } = this.props\n\n return <MDXTag\n name="wrapper"\n \n components={components}><${el}>${text}</${el}>\n </MDXTag>\n }\n}\nMDXContent.isMDXComponent = true`
const elements = [
// Unknown HTML Elements
View gist:b813c931689cb84634afe895e27edbf0
on run {input, parameters}
set dir_name to do shell script "date -u '+%Y%m%dT%H%M%SZ'"
do shell script "mkdir -p ~/Desktop/Screenshots/" & dir_name
tell application "VMware Fusion"
activate
# Large
# do shell script "screencapture -R1810,180,2130,3600 ~/Desktop/Screenshots/$(date -u '+%Y%m%dT%H%M%SZ').png"
@sscotth
sscotth / range.js
Last active October 25, 2020 01:43
Range
View range.js
const range = n => [...Array(n).keys()]
View hangup.xml
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Hangup />
</Response>
@sscotth
sscotth / 1.js
Created March 3, 2020 01:19
Strip Undefined properties
View 1.js
// const obj = { a: undefined, b: 2, c: 0, d: null, e: 0.3, f: "", g: false }
Object.fromEntries(Object.entries(obj).filter(([k, v]) => v != null))
// => {b: 2, c: 0, e: 0.3, f: "", g: false}