Skip to content

Instantly share code, notes, and snippets.

View bragle's full-sized avatar
🧃

Leo Toneff bragle

🧃
View GitHub Profile
@ewencp
ewencp / html_email_preview.js
Last active May 13, 2019 22:09
Quick Javascript hack to preview HTML emails, extracting the HTML portion from a raw email message and stripping it similarly to email clients to preview how it will likely look to the recipient.
(function() {
/* First try to handle pages which are actually raw text of the email.
Extract the HTML part and replace page with it */
var orig_html = document.getElementsByTagName('html')[0].textContent;
var extracted_html = orig_html;
/* Try splitting it up if it's actually the multipart email. Otherwise, work
on the document itself, leaving the orig_html in place */
var boundary_pattern = '--===============';
while (extracted_html.indexOf(boundary_pattern) != -1) {
var next_boundary = extracted_html.indexOf(boundary_pattern);
@christopher-hopper
christopher-hopper / vm-resize-hard-disk.md
Last active April 5, 2022 10:30
Resize a Hard Disk for a Virtual Machine provisioned using Vagrant from a Linux base box to run using VirutalBox.

Resize a Hard Disk for a Virtual Machine

Our Virtual Machines are provisioned using Vagrant from a Linux base box to run using VirutalBox. If the Hard Disk space runs out and you cannot remove files to free-up space, you can resize the Hard Disk using some VirtualBox and Linux commands.

Some assumptions

The following steps assume you've got a set-up like mine, where:

@milo
milo / github-webhook-handler.php
Last active July 26, 2023 15:29
GitHub Webhook Handler
<?php
/**
* GitHub webhook handler template.
*
* @see https://docs.github.com/webhooks/
* @author Miloslav Hůla (https://github.com/milo)
*/
$hookSecret = 's.e.c.r.e.t'; # set NULL to disable check
@christiangalsterer
christiangalsterer / nvd_download.sh
Last active October 23, 2023 05:18
Script to download the National Vulnerability Database files from https://nvd.nist.gov
#!/bin/sh
# https://gist.github.com/christiangalsterer/5f55389b9c50c74c31b9
# Copyright 2015 Christian Galsterer
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#