Skip to content

Instantly share code, notes, and snippets.

View nall's full-sized avatar

Jon Nall nall

View GitHub Profile
#!/bin/bash
# vim: ft=sh sw=4 ts=4 et
# Overview
# --------
# This script queries connected USB devices looking for the Elecraft K4's "Dual RS232" device.
# If such a device is found and the serial devices exist, they are listed as K4 candidates. If
# no devices are found, an error is printed.
#
# Instructions
@nall
nall / obsidian-web-clipper.js
Last active November 5, 2022 08:29 — forked from kepano/obsidian-web-clipper.js
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
javascript: Promise.all([import('https://unpkg.com/turndown@6.0.0?module'), import('https://unpkg.com/@tehshrike/readability@0.2.0'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "LabNotes";
/* Optional folder name such as "Clippings/" */

Keybase proof

I hereby claim:

  • I am nall on github.
  • I am nall (https://keybase.io/nall) on keybase.
  • I have a public key ASBdQFRV-jk4kMDVJUgD5Qul0XAJ1gmyjyHZwPq8m6hppwo

To claim this, I am signing this object:

@nall
nall / InvokeService.m
Created October 16, 2013 21:46
Invoke an OSX service programatically with a specified string llvm-gcc InvokeService.m -o InvokeService -framework Cocoa
#import <Cocoa/Cocoa.h>
void usage(char* progName, NSString* s)
{
NSLog(@"%@", s);
NSLog(@"usage:\n");
NSLog(@":%s <servicename> <pasteboard_contents>\n", progName);
}
int main(int argc, char** argv)
@nall
nall / NSDate+SZRelationalOperators.h
Created April 8, 2013 23:24
Relational operators for NSDate* objects
//
// NSDate+SZRelationalOperators.h
//
// Created by Jon Nall on 12/8/09.
// Copyright 2009 STUNTAZ!!! All rights reserved.
//
// Category to help make comparing NSDates a bit more readable
@interface NSDate(SZRelationalOperators)
@nall
nall / syno_ddns_nsupdate.pl
Last active November 22, 2019 14:14
Crontab script for Synology boxes. Updaes a DNS BIND server when hostname or WAN IP changes. Requires the Synology DNSServer package to be installed (but doesn't need to be running).
#!/opt/bin/perl
use warnings;
use strict;
# Copyright (c) 2013 Jon Nall, STUNTAZ!!! All rights reserved.
#
# This script is intended to be run on a Synology NAS. It attempts
# to determine the external IP where the NAS is connected and then
# checks to see if it needs to update a DNS record. The server is
# updated if any of these are true:
@nall
nall / gist:1383470
Created November 21, 2011 18:36
SVN env var snippet
#define SVN_WC_NG_CHECK_ENV_VAR "SVN_I_LOVE_CORRUPTED_WORKING_COPIES_SO_DISABLE_CHECK_FOR_WC_NG"
static svn_error_t *
is_inside_wc_ng(const char *abspath,
const char *target_path,
int *wc_format,
apr_pool_t *pool)
{
svn_node_kind_t kind;
const char *wc_db_path;
@nall
nall / MenuClick.scpt
Created December 15, 2010 19:44
Shell that allows predefining environment variables before invoking another specified shell
-- `menu_click`, by Jacob Rus, September 2006
--
-- Accepts a list of form: `{"Finder", "View", "Arrange By", "Date"}`
-- Execute the specified menu item. In this case, assuming the Finder
-- is the active application, arranging the frontmost folder by date.
on menu_click(mList)
local appName, topMenu, r
-- Validate our input
on run argv
set theServiceName to "SOMETHING HERE"
set theResult to "No Keychain entry found"
tell application "Keychain Scripting"
set isLocked to locked of current keychain
if (isLocked is true) then
unlock current keychain
end if
@nall
nall / hw_breakpoint.c
Created April 10, 2010 19:08
How to perform breakpoints on ia32/OSX
#include <pthread.h>
#include <stdio.h>
#include <inttypes.h>
#include <signal.h>
#include <mach/mach_types.h>
// compile:
// monoco% gcc -m32 -o break break.m -lpthread -F/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Kernel.framework