Skip to content

Instantly share code, notes, and snippets.

@rwilcox
rwilcox / many_parameters_fill_out_missing.rb
Last active October 4, 2023 21:14
My starter template for creating scripts with lots of parameters that also prompt you to fill out the missing parameters
#!/usr/bin/env ruby
# Why not bash?
# bash is annoying for opts handling
# AND especially annoying if those opts need to be in both --key value AND --key=value format
# AND not DRY.
# and Ruby is pretty close to bash in syntax. Or it's close to Perl, which is close to Bash
# and Python feels like a bunch of boilerplate here
require 'optparse'
version: 1
tasks:
from-net:
command: python3
script: |
print("hi from the network")
// ==UserScript==
// @name Only Github News
// @version 1
// @grant none
// @include /^https?://github\.com\/\?news=only/
// ==/UserScript==
document.querySelector(".team-left-column").remove()
@rwilcox
rwilcox / spanner_client.ts
Last active February 27, 2023 17:17
Spanner and Typescript
// I should probably write a blog post about this, but whatever
import { Spanner, Instance } from '@google-cloud/spanner'
import type { Database } from '@google-cloud/spanner'
/**
Authentication is provided by the local machine user running
`gcloud auth application-default login`
*/
// ==UserScript==
// @name Make Github PR big
// @version 1
// @grant none
// @match https://github.com/*/*/pull/*
// @run-at document-idle
// ==/UserScript==
document.querySelector(".Layout-sidebar").remove()
@rwilcox
rwilcox / Job_hunt_questions.md
Created January 22, 2022 19:11
Career New Job Hunting Questions

Create a mission statement

Professional

Personal

Create an elevator pitch

Scenario: you get into an elevator with some CEO. Why should they hire you? What do you do and what value can you bring to their org?

/*{
"type": "action",
"targets": ["omnioutliner"],
"author": "Marc A. Kastner, with minor edits by Ryan Wilcox",
"description": "Create a markdown compatible format from the current document and export it to Drafts 5.",
"label": "Drafts - New Draft with Markdown format",
"paletteLabel": "Drafts Doc"
}*/
var _ = function() {
@rwilcox
rwilcox / standalone.js
Created March 15, 2019 01:33
Ever wanted to just give someone a single .js file, but also wanted to pull in a Node module? Fret no more!
#!/usr/bin/env node
/*
Node script are kind of cool, but they are hard to low-tech write a Node script for someone and give it to them.
Sure you can publish a package to NPM, set the binary flag, go through some house keeping... but sometimes that's just
not worth the effort.
So: can you distribute a Node script that will install it's own modules from a single file?
const process = require("process")
const superagent = require('superagent')
const Ajv = require("ajv")
// This example is inspired by the idea of https://riposte.in/
// although that package has a way better DSL by not being written in Javascript
// Normally a playground script like this would serve two purposes:
// 1. All developers to pass around scripts of things that Should Work
#from faker import Faker
#fake = Faker('en_US')
#print fake.words() # sentence() #bs() # catch_phrase()
import requests
import random
def main():