Skip to content

Instantly share code, notes, and snippets.

Avatar

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
christiangalsterer / nvd_download.sh
Last active Nov 11, 2021
Script to download the National Vulnerability Database files from https://nvd.nist.gov
View nvd_download.sh
#!/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
#
@milo
milo / github-webhook-handler.php
Last active Nov 7, 2021
GitHub Webhook Handler
View github-webhook-handler.php
<?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
@christopher-hopper
christopher-hopper / vm-resize-hard-disk.md
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.
View vm-resize-hard-disk.md

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
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);