Skip to content

Instantly share code, notes, and snippets.


Leo Toneff bragle

View GitHub Profile
View cartesian-spherical-polar.js
var RAD2DEG = 180 / Math.PI
var DEG2RAD = Math.PI / 180
* Convert [lat,lon] polar coordinates to [x,y,z] cartesian coordinates
* @param {Number} lon
* @param {Number} lat
* @param {Number} radius
* @return {Vector3}
christiangalsterer /
Last active Nov 11, 2021
Script to download the National Vulnerability Database files from
# 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
milo / github-webhook-handler.php
Last active Nov 7, 2021
GitHub Webhook Handler
View github-webhook-handler.php
* GitHub webhook handler template.
* @see
* @author Miloslav Hůla (
$hookSecret = 's.e.c.r.e.t'; # set NULL to disable check
christopher-hopper /
Last active May 13, 2021
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:

ewencp / html_email_preview.js
Last active May 13, 2019
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.
View html_email_preview.js
(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);