Skip to content

Instantly share code, notes, and snippets.

View lmgeorge's full-sized avatar

Lauren George lmgeorge

View GitHub Profile
@lmgeorge
lmgeorge / ssh-keys.sh
Last active March 25, 2024 17:07
Generate ssh keys for a new machine
#!/bin/bash
mkdir ~/.ssh
touch ~/.ssh/authorized_keys
touch ~/.ssh/known_hosts
cat <<EOF > ~/.ssh/config
Host *
User ${USER}
IdentityFile ~/.ssh/host.key
@lmgeorge
lmgeorge / env.groovy
Created October 2, 2020 01:45
Print environment variables and properties
import java.lang.System
import java.util.TreeMap
import java.util.Comparator
def env = new TreeMap<String, String>(System.getenv()).toSorted(new Comparator<Map.Entry<String, String>>() {
@Override
int compare(Map.Entry<String, String> entry1, Map.Entry<String, String> entry2) {
return entry1.key <=> entry2.key
}
})
@lmgeorge
lmgeorge / programming-dates.md
Created October 1, 2020 19:22
Markdown formatted code blocks showing how to use dates

Python

from datetime import datetime
timestamp = datetime.utcnow().strftime('%Y-%m-%dT%H-%M-%S')
# '2020-03019T19-53-07'

R

timestamp &lt;- format(Sys.time(), format="%FT%H-%M-%S", tz="UTC")
@lmgeorge
lmgeorge / idea.properties
Last active August 10, 2022 04:09 — forked from judepereira/idea.vmoptions
Jetbrains IDE vmoptions template
# Use ${idea.home.path} macro to specify location relative to IDE installation home.
# Use ${xxx} where xxx is any Java property (including defined in previous lines of this file) to refer to its value.
# Note for Windows users: please make sure you're using forward slashes: C:/dir1/dir2.
ide.app.name=webstorm
ide.config.home=${user.home}/.jetbrains/${ide.app.name}
#---------------------------------------------------------------------
# Uncomment this option if you want to customize a path to the settings directory.
#---------------------------------------------------------------------
idea.config.path=${ide.config.home}/config
@lmgeorge
lmgeorge / simple-si-unit-conversion.js
Created February 26, 2020 22:03
Simple SI unit conversion
const SI = {
UNITS: ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
BASE: 1024
}
function calculateFileDisplayLength(bytes){
const units = SI.UNITS
const base = SI.BASE
let magnitude = 0;
let accuracy = 0
let unit = units[magnitude]
@lmgeorge
lmgeorge / semimonthly.ics
Last active May 25, 2019 02:47 — forked from DeMarko/sample.ics
iCal: Semi-Monthly Recurring Event Sample. See: https://tools.ietf.org/html/rfc5545#section-3.8.5.3
BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
BEGIN:VEVENT
SUMMARY:Pay Day
DESCRIPTION:This happens on the 15th and last day of the month, forever.
STATUS:CONFIRMED
SEQUENCE:0
DTSTART;VALUE=DATE:20190515
RRULE:FREQ=MONTHLY;INTERVAL=1;BYMONTHDAY=15,-1
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@lmgeorge
lmgeorge / gist:46e3f7e7d41cc4f520f428fd5a051888
Created September 7, 2017 17:22 — forked from EmilVarona/gist:78ae2aff409922686ebff4cea785aed4
Outlook/Mac 2015 raw query item names
<?xml version="1.0" encoding="UTF-8"?>
<schema version="1.0" xmlns="http://www.apple.com/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.apple.com/metadata file:///System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework/Resources/MetadataSchema.xsd">
<!--
Compiled from /Applications/Microsoft\ Outlook.app/Contents/Library/Spotlight/Microsoft\ Outlook\ Spotlight\ Importer.mdimporter/Contents/Resources/schema.xml
with info from http://xensoft.com/search-mac-outlook-2011-mail-with-raw-queries/
-->
<types>
<type name="com.microsoft.outlook15.contact">
<allattrs>
kMDItemTitle
@lmgeorge
lmgeorge / xpath.js
Created May 16, 2017 01:34
Using XPATH w/ JS
var div = document.createElement('div');
var result;
div.innerHTML = $('.tpSubtitleRegion_speaker .gwt-HTML').prop('innerHTML');
result = document.evaluate("//text()", div, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
for(var i=0; i < result.snapshotLength; i++) {
console.dir(result.snapshotItem(i));
}
@lmgeorge
lmgeorge / xterm-256color-italic.terminfo
Created April 17, 2017 05:02 — forked from sos4nt/xterm-256color-italic.terminfo
A xterm-256color based TERMINFO that adds the escape sequences for italic
# A xterm-256color based TERMINFO that adds the escape sequences for italic.
#
# Install:
#
# tic xterm-256color-italic.terminfo
#
# Usage:
#
# export TERM=xterm-256color-italic
#