Skip to content

Instantly share code, notes, and snippets.

@lornajane
lornajane / mac.md
Last active Sep 11, 2021
Keyboard Only OS X
View mac.md

Keyboard-only Mac Cheatsheet

Hi, I'm Lorna and I don't use a mouse. I have had RSI issues since a bad workstation setup at work in 2006. I've tried a number of extra hardware modifications but what works best for me is to use the keyboard and only the keyboard, so I'm in a good position and never reaching for anything else (except my coffee cup!). I rather unwisely took a job which required me to use a mac (I've been a linux user until now and also had the ability to choose my tools carefully) so here is my cheatsheet of the apps, tricks and keyboard shortcuts I'm using, mostly for my own reference. Since keyboard-only use is also great for productivity, you may also find some of these ideas useful, in which case at least something good has come of this :)

Apps List

There's more detail on a few of these apps but here is a quick overview of the tools I've installed and found helpful

Tool Link Comments
@lornajane
lornajane / post.php
Created May 2, 2013
create a gist using PHP and streams
View post.php
<?php
include "github-creds.php"; // sets $access_token
ini_set('user_agent', "PHP"); // github requires this
$api = 'https://api.github.com';
$url = $api . '/gists'; // no user info because we're sending auth
// prepare the body data
$data = json_encode(array(
@lornajane
lornajane / app.py
Created Jul 13, 2020
Very simple Flask webhook receiver
View app.py
import logging
import pprint
from flask import Flask
from flask import jsonify
from flask import request
from pprint import pformat
app = Flask(__name__)
logging.basicConfig(level=logging.DEBUG)
@lornajane
lornajane / guzzle-github.php
Created May 12, 2020
Leeds PHP: Guzzle and SDKs Example Snippets
View guzzle-github.php
<?php
// composer require guzzlehttp/guzzle
require "vendor/autoload.php";
$client = new GuzzleHttp\Client(["base_uri" => "https://api.github.com/"]);
try {
$response = $client->get("/users/lornajane/repos");
if($response->getStatusCode() == 200) {
@lornajane
lornajane / patch.php
Created May 2, 2013
update the gist we made via the GitHub API, using PHP and streams
View patch.php
<?php
include "github-creds.php"; // sets $access_token
ini_set('user_agent', "PHP"); // github requires this
$api = 'https://api.github.com';
$url = $api . '/gists/5501496'; // URL of the specific gist
// prepare the body data
$data = json_encode(array(
View manual.html
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" />
<title>How to use rst2pdf</title>
<meta name="author" content="Roberto Alsina &lt;ralsina&#64;netmanagers.com.ar&gt;" />
<style type="text/css">
@lornajane
lornajane / hi-conf.json
Last active Aug 21, 2018
NCCO greets, then silence
View hi-conf.json
[
{
"action": "talk",
"voiceName": "Salli",
"text": "Your call is connected, you will now join the conference"
},
{
"action": "conversation",
"name": "conf5678"
}
View nexmo-call.sh
UUID=$(curl -s -X POST https://api.nexmo.com/v1/calls \
-H "Authorization: Bearer "$JWT\
-H "Content-Type: application/json"\
-d '{"to":[{"type": "phone","number": "'$TO_NUMBER'"}],
"from": {"type": "phone","number": "'$NEXMO_NUMBER'"},
"answer_url":["https://developer.nexmo.com/ncco/tts.json"]}' \
| awk -F "[,:]" '/uuid/{print substr($2,2,length($2)-2)}')
@lornajane
lornajane / people.sql
Created Apr 4, 2016
Material to accompany JSON data type examples
View people.sql
-- MySQL dump 10.13 Distrib 5.6.28, for debian-linux-gnu (x86_64)
--
-- Host: 127.0.0.1 Database: demo
-- ------------------------------------------------------
-- Server version 5.7.11
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
@lornajane
lornajane / notifier.js
Created Nov 17, 2017
Send a webhook from serverless js on openwhisk
View notifier.js
function main(data) {
return new Promise(function(resolve, reject) {
var request = require('request');
if(data.status == 'new') {
var message = "New question: <" + data.question.link + "|" + data.question.title + "> (tagged: " + data.question.tags + ")";
var options = {
"text": message,
"icon_emoji": ":postit:"