Skip to content

Instantly share code, notes, and snippets.

Avatar

Matthew Newton mnewt

View GitHub Profile
@mnewt
mnewt / *lsp-log*
Last active Sep 1, 2020
GDScript warnings example
View *lsp-log*
[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 Aug 17, 2020
Work in progress attempt at using homebrew to build and install a GUI app
View gccemacs.rb
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 Aug 7, 2020
Add magnet links to Limetorrents
View limetorrents_magnet_links.user.js
@mnewt
mnewt / torrentz2_magnet_links.user.js
Last active Feb 19, 2021
Add magnet links to Torrentz2
View torrentz2_magnet_links.user.js
@mnewt
mnewt / dsr.js
Last active May 3, 2018
Get the current column and row in the terminal using ANSI Device Status Report
View dsr.js
#!/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 Sep 16, 2019
keybase.md
View 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 Nov 6, 2017
Lumo script demonstrating environment variable exports
View source.cljs
(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 Jun 16, 2017
Download a file iff URL's HTTP If-Modified-Since header is more recent than the local file timestamp
View download_if_newer.sh
#!/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
Shell script to download a github project's latest release
View gh-download-latest
#!/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
Search for matching miniflux items and mark them as read
View mark_read.php
#!/usr/bin/env php
<?php
require __DIR__.'/miniflux/app/common.php';
use PicoDb\Database;
use Miniflux\Model\Item;
if (php_sapi_name() !== 'cli') {