Skip to content

Instantly share code, notes, and snippets.

View mnewt's full-sized avatar

Matthew Newton mnewt

View GitHub Profile
@mnewt
mnewt / *lsp-log*
Last active September 1, 2020 18:11
GDScript warnings example
[Trace - 03:27:31 PM] Sending request 'textDocument/documentLink - (346)'.
Params: {
"textDocument": {
"uri": "file:///Users/mn/Dropbox/Matt/code/Finnland/Player.gd"
}
}
[Trace - 03:27:31 PM] Received response 'textDocument/documentLink - (346)' in 41ms.
Result: []
@mnewt
mnewt / gccemacs.rb
Created August 17, 2020 16:52
Work in progress attempt at using homebrew to build and install a GUI app
class Emacs < Formula
desc "GNU Emacs Native Compiled"
homepage "https://akrl.sdf.org/gccemacs.html"
head "git://git.sv.gnu.org/emacs.git", :branch => "feature/native-comp"
depends_on "autoconf" => :build
depends_on "pkg-config" => :build
depends_on "texinfo" => :build
depends_on "gcc"
depends_on "gnupg"
@mnewt
mnewt / limetorrents_magnet_links.user.js
Created August 7, 2020 20:19
Add magnet links to Limetorrents
@mnewt
mnewt / torrentz2_magnet_links.user.js
Last active February 19, 2021 18:25
Add magnet links to Torrentz2
@mnewt
mnewt / dsr.js
Last active May 3, 2018 21:25
Get the current column and row in the terminal using ANSI Device Status Report
#!/usr/bin/env node
// Loosely based on https://stackoverflow.com/questions/36929209/read-ansi-escape-from-terminal
'use strict';
var deasync = require('deasync');
function asyncDSR(opts, callback) {
// opts is an optional object:
// { in: input }
@mnewt
mnewt / keybase.md
Last active September 16, 2019 17:15
keybase.md

Keybase proof

I hereby claim:

  • I am mnewt on github.
  • I am mnewt (https://keybase.io/mnewt) on keybase.
  • I have a public key ASBr9rFhvh1zj6ZXu6Zvi7j0G4trGLu-ze6rKtNH8_HOfwo

To claim this, I am signing this object:

@mnewt
mnewt / source.cljs
Created November 6, 2017 04:33
Lumo script demonstrating environment variable exports
(require '[clojure.data :refer [diff]])
(def ^:no-doc fs (js/require "fs"))
(def ^:no-doc child-process (js/require "child_process"))
(def ^:no-doc os (js/require "os"))
(def ^:no-doc path (js/require "path"))
(def ignore-env-vars #{"_" "OLDPWD" "PWD" "SHELLOPTS" "SHLVL"})
(defn mktemp
@mnewt
mnewt / download_if_newer.sh
Created June 16, 2017 14:52
Download a file iff URL's HTTP If-Modified-Since header is more recent than the local file timestamp
#!/usr/bin/env bash
# Download a file iff URL's HTTP If-Modified-Since header is more recent than
# the local file timestamp
url="$1"
file="$2"
shift 2
curl -z "$file" -Lo "$file" "$url" "$@"
@mnewt
mnewt / gh-download-latest
Created May 20, 2017 21:33
Shell script to download a github project's latest release
#!/bin/sh
# Download a github project's latest release
# $1: username/repo
# $2: regex to match download file
# example: ./gh-download-latest atom/atom gz
repo=$1
regex=${2:-gz}
wget -qO- https://api.github.com/repos/$repo/releases/latest | \
@mnewt
mnewt / mark_read.php
Created May 16, 2017 18:51
Search for matching miniflux items and mark them as read
#!/usr/bin/env php
<?php
require __DIR__.'/miniflux/app/common.php';
use PicoDb\Database;
use Miniflux\Model\Item;
if (php_sapi_name() !== 'cli') {