Skip to content

Instantly share code, notes, and snippets.

View lodestone's full-sized avatar
:octocat:
🤘Grokking Out 🤘

Matthew Petty lodestone

:octocat:
🤘Grokking Out 🤘
  • Kizmeta
  • Kansas City Area, Missouri
  • 21:49 (UTC -12:00)
View GitHub Profile
#! python3
# smwtimer2.py - A simple countdown script.
# Using datetime
import time, datetime
from subprocess import call
call(["ls", "-l"])
pomStart = datetime.datetime.now()
pomTime = datetime.timedelta(minutes=25)
@lodestone
lodestone / tumblr-to-middleman.rb
Created April 6, 2018 17:48 — forked from matiaskorhonen/tumblr-to-middleman.rb
Tumblr blog post extraction code. Pretty much tailored for my needs when I migrated from Tumblr to Middleman, but this might still be of use to someone…
#!/usr/bin/env ruby
require "tumblr_client"
require "time"
require "yaml"
require "fileutils"
require "open-uri"
require "nokogiri"
require "loofah"
require "reverse_markdown"
@lodestone
lodestone / _intro.md
Last active March 19, 2018 13:26
A Small Ruby vs Crystal Comparison

A Small Ruby vs Crystal Test

I recently had to write a quick script to update a text file full of pdf annotations. I wrote the script in Ruby then I wondered how much of a difference in speed I would get if I turned it into Crystal. See below.

{
"~f" = "moveWordForward:"; /* M-f */
"~b" = "moveWordBackward:"; /* M-b */
"~w" = (selectWord:);
// select entire line/paragraph
"@L" = (selectParagraph:);
// select from beginning of paragraph to last character
"@l" = (moveToBeginningOfParagraph:, moveToEndOfParagraphAndModifySelection:);
// bookmark
"~1" = (setMark:);
# Copyright (c) 2009 rupa deadwyler. Licensed under the WTFPL license, Version 2
# maintains a jump-list of the directories you actually use
#
# INSTALL:
# * put something like this in your .bashrc/.zshrc:
# . /path/to/z.sh
# * cd around for a while to build up the db
# * PROFIT!!
# * optionally:
{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": false,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {
@lodestone
lodestone / simple_gpio_with_javascript.js
Created August 30, 2017 21:42 — forked from chaddotson/simple_gpio_with_javascript.js
This snippet is intended to be the hello world equivalent for working with the raspberry pi gpio with node.js. This simply flashes an LED connected to pin 7 based on the duration.
/*
Requires:
- pi-gpio
- gpio-admin
This snippet is intended to be the hello world equivalent for working
with the raspberry pi gpio with node.js. This simply flashes an LED
connected to pin 7 based on the duration.
*/
export EDITOR=nvim
export PATH=$PATH:$HOME/.fzf/bin
export ZSH_AUTOSUGGEST_USE_ASYNC=true
source $HOME/.zsh/antigen.zsh
# Load the oh-my-zsh's library.
antigen use oh-my-zsh
# Bundles from the default repo (robbyrussell's oh-my-zsh).
# Copyright (c) 2009 rupa deadwyler. Licensed under the WTFPL license, Version 2
# maintains a jump-list of the directories you actually use
#
# INSTALL:
# * put something like this in your .bashrc/.zshrc:
# . /path/to/z.sh
# * cd around for a while to build up the db
# * PROFIT!!
# * optionally:
@lodestone
lodestone / get_title_and_url.applescript
Created August 24, 2017 00:52 — forked from vitorgalvao/Get Title and URL.applescript
AppleScript and JavaScript for Automation to get frontmost tab’s url and title of various browsers.
-- AppleScript --
-- This example is meant as a simple starting point to show how to get the information in the simplest available way.
-- Keep in mind that when asking for a `return` after another, only the first one will be output.
-- This method is as good as its JXA counterpart.
-- Google Chrome
tell application "Google Chrome" to return title of active tab of front window
tell application "Google Chrome" to return URL of active tab of front window
-- Google Chrome Canary