Skip to content

Instantly share code, notes, and snippets.

View cori's full-sized avatar
🏠
Scruggs!

cori schlegel cori

🏠
Scruggs!
View GitHub Profile
@cori
cori / roam-quick-capture.js
Last active March 30, 2023 03:50
Roam Quick Capture with Page Title Userscript
// ==UserScript==
// @name Roam Quick Note with Page Title
// @version 0.0.1
// @description Quick notes selected text to Roam.
// @author cori schlegel
// @match *
// @grant GM.registerButton
// @grant GM.openInTab
// @noframes
// ==/UserScript==
@cori
cori / sorting-aws-cli-describe-images-output.md
Created October 27, 2021 15:36 — forked from michalstala/sorting-aws-cli-describe-images-output.md
How to sort AWS CLI describe-images output using jd

As an example query AWS for a list of all NAT Instance AMIs:


aws ec2 describe-images --filter Name="owner-alias",Values="amazon" --filter Name="name",Values="amzn-ami-vpc-nat*" --region us-west-2 | jq '.Images | sort_by(.CreationDate)'

If only specific fields are required to print into output:

jq -r 'paths(scalars) as $p | "." + ([([$p[] | tostring] | join(".")), (getpath($p) | tojson)] | join(": "))'
@cori
cori / jon-roam-daily-template.md
Created April 6, 2020 11:51 — forked from jborichevskiy/jon-roam-daily-template.md
The daily template Jon uses for Roam Research https://roamresearch.com/
  • Weekly Agenda (created on a different day, and embedded with /Block Reference)
  • [[Morning Questions]] [[2/24 -- 3/1/2020]]
    • {{[[slider]]}} How many hours of sleep did I get?
    • [[What's one thing top of mind today?]]
    • [[What's the one thing I need to get done today to make progress?]]
  • Agenda
    • {{[[TODO]]}} 2 hours focused time
    • {{[[TODO]]}} Read 30 minutes #goal-learning #habit
  • Health & self-care
  • {{[[TODO]]}} 30 minutes outside #goal-health #habit
@cori
cori / glitch-bookmarklets.js
Created May 17, 2019 19:01
Glitch-y bookmarklets
javascript:let domain = window.prompt('Domain?');window.location = `https://glitch.com/edit/#!/${domain}`
javascript:let domain = window.prompt('Domain?');window.location = `https://glitch.com/~${domain}`;
javascript:let domain = window.prompt('Domain?');window.location = `https://glitch.com/edit/#!/remix/${domain}`
javascript:let domain = window.prompt('Domain?');window.location = `https://glitch.com/edit/console.html?${domain}`
javascript:document.location = 'https://glitch.com/edit/#!/' + document.location.hostname.replace('.glitch.me','');
@cori
cori / echo.rb
Created September 25, 2018 02:38 — forked from dtchepak/echo.rb
Simple Ruby HTTP server to echo whatever GET or POST requests come through. Largely based on https://www.igvita.com/2007/02/13/building-dynamic-webrick-servers-in-ruby/.
# Reference: https://www.igvita.com/2007/02/13/building-dynamic-webrick-servers-in-ruby/
require 'webrick'
class Echo < WEBrick::HTTPServlet::AbstractServlet
def do_GET(request, response)
puts request
response.status = 200
end
def do_POST(request, response)
puts request
@cori
cori / webrick_start.sh
Created September 21, 2018 03:17 — forked from gautamk/webrick_start.sh
Start webrick server to serve files in the local directory
ruby -r webrick -e "s = WEBrick::HTTPServer.new(:Port => 8000, :DocumentRoot => Dir.pwd); trap('INT') { s.shutdown }; s.start"
@cori
cori / ddns.conf
Created September 15, 2018 13:53
location of the ddns configuration file on a QNAP TS-253-A
/mnt/HDA_ROOT/.config/ddns.conf
config segment looks like
[iwantmyname]
username = cori.schlegel@gmail.com
enable = 1
ip4 =
update_url = https://iwantmyname.com/basicauth/ddns?hostname=%HOST%
password = ****
pass_criteria = nochg,good
@cori
cori / settings.json
Created July 11, 2018 13:24
VS Code settings for eslint options blob (specifically disable no-console)
{
"eslint.options": { "rules":{"no-console": 0} }
}
@cori
cori / glitch-init.sh
Last active January 27, 2019 04:42
init file to set up glitch env
#! /bin/bash
# this script adds ~3Mb to your glitch container's /app directory
# `wget https://gist.githubusercontent.com/cori/9a39a672ca8f0297e59436d58ce3393c/raw -O glitch-init.sh`
# `chmod +x glitch-init.sh`
# `./glitch-init.sh`
# `source ~/.bashrc`
# install bash-it
if [ -d ~/.bash_it ]; then
source ~/.bashrc