Skip to content

Instantly share code, notes, and snippets.

@egladman
egladman / index.html
Created September 26, 2015 20:48
simpleWeather.geolocation.js
.weather
#code
#condition
#sunrise
#sunset
// https://gist.github.com/TheDistantSea/8021359
function versionCompare(v1, v2, options) {
var lexicographical = options && options.lexicographical,
zeroExtend = options && options.zeroExtend,
v1parts = v1.split('.'),
v2parts = v2.split('.');
function isValidPart(x) {
return (lexicographical ? /^\d+[A-Za-z]*$/ : /^\d+$/).test(x);
@egladman
egladman / find_gh_username.sh
Last active July 15, 2016 09:00
Determines a person's Github username from their git config
#!/bin/bash
email=$(git config --global user.email)
json=$(curl -s "https://api.github.com/search/users?q=${email}+in:email")
echo $json | grep -Po '(?<="login": ")[^"]*'
@egladman
egladman / svg_to_dxf.sh
Last active December 6, 2016 17:35
convert svgs to dxf
#!/bin/bash
dependencies=(
"inkscape"
"pstoedit"
)
# check if dependencies are indeed installed
for program in "${dependencies[@]}"
do
@egladman
egladman / git_approval.sh
Created February 12, 2017 21:47
Prevent accidental changes from being committed to git
#Append the following snippet to your bash.rc
#Whenever "git add foo" is ran "git diff" will first run
#and require user confirmation before changes are added.
git() {
if [[ $1 == "add" ]]; then
command git diff
read -p "Are you sure? " -n 1 -r
echo

Cuddled

if (condition) {
  //stuff
} else {
  //stuff
}
@egladman
egladman / extractFrames.js
Last active May 30, 2018 22:09
Extract all frames of a gif to their respective images
// Quick and dirty script that I'll only use once...
// Grabs all the frames in a gif and write them to individual files
//
// Example
// node extractFrames.js --gif path/to/gif
const gifFrames = require('gif-frames');
const argv = require('yargs').argv
const fs = require('fs');
@egladman
egladman / roundedcube.scad
Created November 22, 2019 01:48 — forked from groovenectar/roundedcube.scad
roundedcube.scad - Fork me and make me better!
// More information: https://danielupshaw.com/openscad-rounded-corners/
// Set to 0.01 for higher definition curves (renders slower)
$fs = 0.15;
module roundedcube(size = [1, 1, 1], center = false, radius = 0.5, apply_to = "all") {
// If single value, convert to [x, y, z] vector
size = (size[0] == undef) ? [size, size, size] : size;
translate_min = radius;
@egladman
egladman / roundedcube.scad
Created November 22, 2019 01:48 — forked from groovenectar/roundedcube.scad
roundedcube.scad - Fork me and make me better!
// More information: https://danielupshaw.com/openscad-rounded-corners/
// Set to 0.01 for higher definition curves (renders slower)
$fs = 0.15;
module roundedcube(size = [1, 1, 1], center = false, radius = 0.5, apply_to = "all") {
// If single value, convert to [x, y, z] vector
size = (size[0] == undef) ? [size, size, size] : size;
translate_min = radius;
From 1a74985b2a404639b08882c57f3147229605dfd5 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Tue, 19 Apr 2016 06:50:31 -0400
Subject: [PATCH] extlinux: pull in sys/sysmacros.h for major/minor/makedev
https://wiki.syslinux.org/wiki/index.php?title=Building
These functions are defined in sys/sysmacros.h, so add the include to
main.c. This is already handled correctly in mountinfo.c. Otherwise
we get build failures like: