Skip to content

Instantly share code, notes, and snippets.

View bradymholt's full-sized avatar

Brady Holt bradymholt

View GitHub Profile
@ScottMaclure
ScottMaclure / slack_draft_deleter.js
Last active May 9, 2024 14:58
Slack Draft Deleter
// Remove all drafts from your drafts view
// Navigate to drafts
// F12 to raise dev console
// Paste the below
(async function(x) {
for (let e = document.querySelector('[type="trash"]'); e != null; e = document.querySelector('[type="trash"]')) {
e.click();
await new Promise(resolve => setTimeout(resolve, 500))
document.querySelector('[data-qa="drafts_page_draft_delete_confirm"]').click();
await new Promise(resolve => setTimeout(resolve, 1500))
@adepasquale
adepasquale / Dockerfile.postfix-catchall
Last active February 22, 2021 08:43
Dockerfile for Postfix server with catch-all configuration
FROM alpine:latest
RUN apk add --no-cache postfix postfix-pcre rsyslog
RUN postconf -e "myhostname=localhost" \
&& postconf -e "mynetworks_style=host" \
&& postconf -e "mail_spool_directory=/var/mail/" \
&& postconf -e "virtual_alias_maps=pcre:/etc/postfix/virtual" \
&& echo "/.*/ root" > /etc/postfix/virtual \
&& postmap /etc/postfix/virtual \
@bradymholt
bradymholt / Zbig-o.png
Last active October 22, 2021 13:16
Computer Science Concepts
Zbig-o.png
@loicginoux
loicginoux / firebase-messaging-sw.js
Last active June 11, 2024 02:39
Adding FCM to an html page to receive notifications and sending then via FCM ruby gem. (edit: HTTPS needed!)
// [START initialize_firebase_in_sw]
// Give the service worker access to Firebase Messaging.
// Note that you can only use Firebase Messaging here, other Firebase libraries
// are not available in the service worker.
importScripts('https://www.gstatic.com/firebasejs/3.5.2/firebase-app.js');
importScripts('https://www.gstatic.com/firebasejs/3.5.2/firebase-messaging.js');
// Initialize the Firebase app in the service worker by passing in the
// messagingSenderId.
firebase.initializeApp({

Tape vs Mocha

What is Mocha? Mocha is a feature-rich JavaScript test framework running on Node.js and in the browser.

What is Tape? Tape is a tap-producing test harness for node and browsers

Comparision

Features

Feature Tape Mocha
@cschiewek
cschiewek / x11_docker_mac.md
Last active June 29, 2024 02:37
X11 in docker on macOS

To forward X11 from inside a docker container to a host running macOS

  1. Install XQuartz: https://www.xquartz.org/
  2. Launch XQuartz. Under the XQuartz menu, select Preferences
  3. Go to the security tab and ensure "Allow connections from network clients" is checked.
  4. Run xhost + ${hostname} to allow connections to the macOS host *
  5. Setup a HOSTNAME env var export HOSTNAME=`hostname`*
  6. Add the following to your docker-compose:
 environment:
@raphaelm
raphaelm / INSTRUCTIONS.md
Last active November 26, 2019 20:01
letsencrypt.sh ansible role

Step zero: Install this role by creating the directories roles/letsencrypt/, roles/letsencrypt/files/ and roles/letsencrypt/tasks/. Then save the tasks.yml from this gist as roles/letsencrypt/tasks/main.yml and config.sh from this gist as roles/letsencrypt/files/config.sh.

Step one: Add the following to your nginx server config

location /.well-known/acme-challenge {
    root /var/www/letsencrypt;
}

Step two: Execute the ansible role, e.g. using

@halberom
halberom / opt1_template.j2
Last active April 12, 2024 11:33
ansible - example of template if else
{# style 1 - long form #}
{% if filepath == '/var/opt/tomcat_1' %}
{% set tomcat_value = tomcat_1_value %}
{% else %}
{% set tomcat_value = tomcat_2_value %}
{% endif %}
{# style 2 - short form #}
{% set tomcat_value = tomcat_1_value if (filepath == '/var/opt/tomcat_1') else tomcat_2_value %}
@peterflynn
peterflynn / Useful GitHub bookmarklets
Last active August 30, 2023 06:54
GitHub comment thread bookmarklets
To use: create a new bookmark and paste into the URL field.
In Chrome, you can paste the full multiline code as shown below.
In other browsers, you may need to minify the code into one line first.
@nixjdm
nixjdm / speedtest.sh
Last active July 30, 2023 14:28
This bash script repeatedly tests the page load times of a website and gives some basic stats for the results.
#!/usr/bin/env bash
########################################################################
# Author: Joseph Nix nixjdm@terminallabs.com 6-18-2015
# Copyright (c) 2015 Terminal Labs
# Distributed under the MIT License.
# (See http://opensource.org/licenses/MIT)
#
# This tests the average page load time for a given url. It can be set
# to run any number of tests, and then will average the results.
#