Skip to content

Instantly share code, notes, and snippets.

View davidhaley's full-sized avatar

David Haley davidhaley

View GitHub Profile
@davidhaley
davidhaley / hers.sh
Created July 9, 2024 01:24 — forked from alganet/hers.sh
Fast and portable mouse/keyboard terminal capture (zsh,ksh,mksh,bash on Windows+WSL, Linux or Mac OS)
#!/bin/sh
# Quick run: bash -c "$(curl -L https://git.io/fjToH)"
# CTRL+W to exit
set -euf
unsetopt FLOW_CONTROL GLOB NO_MATCH NO_SH_WORD_SPLIT NO_PROMPT_SUBST 2>/dev/null || :
write ()
{
@abraithwaite
abraithwaite / chill-zoom.sh
Last active May 8, 2024 08:43
Zoom in Systemd Cgroups on Linux. Change the max allocations to fit your workstation.
#!/usr/bin/bash -xe
cat <<EOF > "${HOME}/.config/systemd/user/zoom.slice"
[Slice]
AllowedCPUs=0-4
MemoryHigh=6G
EOF
cat /usr/share/applications/Zoom.desktop | sed -E 's#^(Exec=).*$#Exec=/usr/bin/systemd-run --user --slice=zoom.slice /opt/zoom/ZoomLauncher#' > "${HOME}/.local/share/applications/Zoom.desktop"
@amazingidiot
amazingidiot / README.md
Created August 14, 2021 09:56
Pipewire virtual devices as systemd user services

Create pipewire virtual devices as systemd user services

Add both files to ~/.config/systemd/user/ and enable them via systemctl --user enable --now pipewire-source-stereo@sourcename.service or systemctl --user enable --now pipewire-sink-stereo@sinkname.service. Change sourcename and sinkname in the command to your needs. You can add multiple devices with different names.

@sindresorhus
sindresorhus / esm-package.md
Last active July 23, 2024 02:20
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@dylanmckay
dylanmckay / facebook-contact-info-summary.rb
Last active March 12, 2024 22:46
A Ruby script for collecting phone record statistics from a Facebook user data dump
#! /usr/bin/env ruby
# NOTE: Requires Ruby 2.1 or greater.
# This script can be used to parse and dump the information from
# the 'html/contact_info.htm' file in a Facebook user data ZIP download.
#
# It prints all cell phone call + SMS message + MMS records, plus a summary of each.
#
# It also dumps all of the records into CSV files inside a 'CSV' folder, that is created