Skip to content

Instantly share code, notes, and snippets.

View dweingart's full-sized avatar

David Weingart dweingart

  • UNH-IOL
  • New Hampshire
View GitHub Profile
@goingtomaine
goingtomaine / notes.fish
Created July 18, 2022 17:24
A fish function for creating, editing, archiving, and searching for notes
function notes
argparse 'a/archive' 'e/editor=' 'h/help' 'i/interactive' 'o/open' 'p/path' 'rm' 's/suffix=' -- $argv
or return 1
set -q _flag_i _flag_o _flag_p
if [ $status -lt 3 ]
if [ (count $argv) -gt 0 ]
echo "Must not provide an argument to the --interactive, --open, or --path flags"
return 1
@junaidpv
junaidpv / UpdateCommands.php
Created December 28, 2021 13:27
Drush command to fix "non-existent config entity name returned by FieldStorageConfigInterface::getBundles()" errors reported at https://www.drupal.org/project/drupal/issues/2916266
<?php
namespace Drupal\my_module\Commands;
use Drush\Commands\DrushCommands;
use Drupal\Core\KeyValueStore\KeyValueFactoryInterface;
/**
* A Drush commandfile.
*
@sbyx
sbyx / low-battery-level-detection-notification-for-all-battery-sensors.yaml
Last active June 14, 2024 22:32
Home Assistant Blueprint: Low battery level detection & notification for all battery sensors
blueprint:
name: Low battery level detection & notification for all battery sensors
description: Regularly test all sensors with 'battery' device-class for crossing
a certain battery level threshold and if so execute an action.
domain: automation
input:
threshold:
name: Battery warning level threshold
description: Battery sensors below threshold are assumed to be low-battery (as
well as binary battery sensors with value 'on').
@tanaikech
tanaikech / submit.md
Last active April 16, 2024 14:46
Modifying Revisions of a File on Google Drive using Google Apps Script

Modifying Revisions of a File on Google Drive using Google Apps Script

This is a sample script for modifying the revisions of a file on Google Drive using Google Apps Script. This script can be used for not only Google Docs files, but also the files except for Google Docs.

Issue and workaround:

Unfortunately, in the current stage, at Google Docs files, the revision of Google Docs cannot be directly changed by APIs with a script. So as one of several workarounds, I would like to propose to overwrite the Google Docs file using the exported data. On the other hand, at the files except for Google Docs, the data can be directly retrieved with the revision ID. This can be used for overwriting the file. The flow of this script is as follows.

For Google Docs files:

@loganvolkers
loganvolkers / Byte Formatting for Google Sheets.md
Last active June 14, 2024 02:36
Byte formatting for Google Sheets
@RulerOf
RulerOf / centos-extras-on-OEL7.md
Last active October 29, 2022 17:17
Adding Centos Extras repo to Oracle Enterprise Linux 7

Adding CentOS Extras to Oracle Enterprise Linux

If you want to install a package like Docker Community Edition on OEL, you'll have to add the CentOS Extras repo, which as of release 7 is built-in to CentOS and not added on later like EPEL is. As a result, instructions for adding it to EL7 are hard to find. This should work for any build of Enterprise Linux that does not already include the CentOS Extras repo. I have absolutely no idea if it's apporpriate to use this repo on a build of Linux other than CentOS, but it should be.

This was tested on Oracle Enterprise Linux 7, but should be copy-pastable on any version or EL build assuming things don't change too much.

Download the CentOS GPG Key

# Get OS Release number
@kalebo
kalebo / Instructions.md
Created October 4, 2017 17:35
Instructions on setting up a FlexLM daemon for SystemD

Setting up a FlexLM service for SystemD

Create directory structure

  1. Create the directory for the flexlm user to use, e.g., /opt/flexlm
  2. Place all the binaries for the licence manager and the licence in a vendor specific subdirectory

At this point you should have something similar to following directory structure:

/opt/flexlm/
└── VENDOR
@PacodiazDG
PacodiazDG / http-get-dos.conf
Created April 12, 2017 06:01 — forked from SamStudio8/http-get-dos.conf
Simple fail2ban DOS jail
# Fail2Ban configuration file
#
# NOTE
# You should set up in the jail.conf file, the maxretry and findtime carefully in order to avoid false positives.
#
# Author: http://www.go2linux.org
# Modified by: samnicholls.net
# * Mon 6 Jun 2016 - Updated failregex to capture HOST group correctly
[Definition]
@dominic-p
dominic-p / zfs-dkms-fix.sh
Last active September 1, 2023 18:25
A simple script to automate rebuilding ZFS related DKMS modules after a kernel upgrade. USE WITH CAUTION.
#!/bin/sh
#
# --- zfs-dkms-fix.sh ---
#
# This script automates the process of fixing ZFS after a kernel
# update. See: https://github.com/zfsonlinux/zfs/issues/3801
###################################################################
# Get the current ZFS and SPL module versions
modversion=$(dkms status | cut -d , -f 2 | tail -n 1 | xargs)
@v-jacob
v-jacob / Mailhog Bash Script (systemd)
Last active January 9, 2023 08:51
Mailhog setup with systemd
#!/usr/bin/env bash
echo ">>> Installing Mailhog"
# Download binary from github
wget --quiet -O ~/mailhog https://github.com/mailhog/MailHog/releases/download/v1.0.0/MailHog_linux_amd64
# Make it executable
chmod +x ~/mailhog