Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Looking for a new opportunity

James Brown jbrown123

💭
Looking for a new opportunity
View GitHub Profile
@jbrown123
jbrown123 / mylib.scad
Created Feb 9, 2020
A library of openscad functions that I frequently use in my designs
View mylib.scad
/*
* MyLib.scad
*
* A bunch of openscad functions that I might need from time to time in various projects
*
* Usage: use <mylib.scad>;
*
* Version: 20200209
*
* Copyright (c) 2011-2020 by James H. Brown
@jbrown123
jbrown123 / uta-wifi.user.js
Created Aug 15, 2019
Auto login to UTA (Utah Transit Authority) WiFi - ticks the accept conditions checkbox, then clicks the connect button
View uta-wifi.user.js
// ==UserScript==
// @name Auto login to UTA WiFi
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Check the box and press the button on the UTA wifi page
// @author James Brown
// @match http://utawifi.com/
// @grant none
// @require http://code.jquery.com/jquery-latest.js
// ==/UserScript==
@jbrown123
jbrown123 / AccessGithubWithPuTTY.md
Created Jul 1, 2019
How to use PuTTY with github on Windows
View AccessGithubWithPuTTY.md

How to use PuTTY with github on Windows

To make things easier, we can tell git to use the PuTTY tools rather than the built in ssh client. The PuTTY tools include an identity manager and an SSH replacement.

Follow these four steps:

  1. Download and install PuTTY using the MSI installer package from the PuTTY download page. Alternately, you can just get the "PLink" and "Pageant" executables from the same page and save them somewhere in your path.

  2. Add a new user or system environment variable:

  • Press Windows+R and enter sysdm.cpl
@jbrown123
jbrown123 / alarmclock.pl
Created Mar 21, 2019
A simple recurring alarm clock written in Perl (does not require any packages, just plain perl). This version is specific to Windows but could easily be converted to other platforms.
View alarmclock.pl
#!/usr/bin/env perl
#
# a (very simple) recurring alarm clock for windows
# easily converted to any other platform by replacing the call to the windows msg tool
# all data is stored in the file itself (in the __DATA__ section at the bottom)
# this is written in pure perl, no packages are required
#
# under windows I suggest using the ActiveState wperl interpreter to launch the alarm clock
# that prevents you from having a command processor hanging around just to run the alarm clock
# the unfortunate side effect is that you have to kill it using task manager since it never exits
@jbrown123
jbrown123 / unsplash_random.html
Created Mar 20, 2019
Unsplash randomly rotating images
View unsplash_random.html
<html>
<head>
<title>Unsplash images</title>
<script>
// randomly cycle through unsplash images in the browser window every 5-30 seconds
// this works great in full screen (F11) mode on wall monitors as random artwork
//
// tested on Chrome; should work on most modern browsers but don't blame me if it doesn't
// I used info from the following sites to create this
@jbrown123
jbrown123 / readme.md
Last active Apr 21, 2020
Reference bookmarklet - generate a string containing the page title, URL and any selected text
View readme.md

Reference bookmarklet

This bookmarklet will grab 2 or 3 bits of info from the currently viewed webpage and put them into an 'alert' so you can copy & paste into another document.

It should work in any desktop browser (chrome, firefox, ect.) on any OS but I've only personally tested it in Chrome on Windows.

You can press either enter or escape after copying the text. It doesn't make any difference which one you use.

For example, the above URL points to the bookmarklet entry on Wikipedia. If you used the reference bookmarklet on that page it would return the following:

@jbrown123
jbrown123 / initialization.sql
Last active Jul 13, 2020
Creating arbitrary-depth recursive queries in SQLITE (works for any SQL compliant system) using CTEs (common table expressions)
View initialization.sql
DROP TABLE IF EXISTS users;
DROP VIEW IF EXISTS bp;
CREATE TABLE users (name, cn, title, manager);
CREATE VIEW bp AS
-- create a CTE (common table expression)
-- think of this as creating a temporary table that only exists during this query
-- works somewhat like CREATE TEMPORARY TABLE bosspath(cn, path)
WITH RECURSIVE bosspath(cn,path) AS
(
@jbrown123
jbrown123 / US Zip Codes to Lat Lon from 2016 Government Census Data
Last active May 5, 2017
All US zip codes (technically "five digit ZIP code tabulation area census codes") with their corresponding latitude and longitude coordinates. Positive values = North or East; Negative values = South or West. Comma delimited for easy import. Source: http://www.census.gov/geo/maps-data/data/gazetteer.html Built with the following commands: unzip …
View US Zip Codes to Lat Lon from 2016 Government Census Data
ZIP,LAT,LON
00601,18.180555,-66.749961
00602,18.361945,-67.175597
00603,18.455183,-67.119887
00606,18.158345,-66.932911
00610,18.295366,-67.125135
00612,18.402253,-66.711397
00616,18.420412,-66.671979
00617,18.445147,-66.559696
00622,17.991245,-67.153993
@jbrown123
jbrown123 / bookmarklet.md
Last active Nov 6, 2018
A simple bookmarklet to help clip a webpage to a google doc
View bookmarklet.md

Bookmarklet to clip webpages to google docs

Below is a simple bookmarklet (see https://en.wikipedia.org/wiki/Bookmarklet) to make it easier to capture the content of a webpage into a google doc. This is similar (but much simpler and less functionality) to Evernote Web Clipper (see https://evernote.com/webclipper/).

This bookmarklet will copy the URL and the title of the current page. Since most browsers forbid directly manipulating the clipboard contents, it makes a copy by creating a pop-up with all the data highlighted and asks the user to press control-c (the keyboard copy shortcut) and then enter. Once you press enter it will create a new google document for you in a new tab. You can simply press control-v (the keyboard paste shortcut) to put in the URL and title.

If you press escape or hit 'cancel' in the popup, nothing happens and you return to your original webpage.

If you happen to have some text selected on the current webpage, this will be appended to the end of the pasted block. However,

@jbrown123
jbrown123 / reveal per-slide theme override.js
Last active May 11, 2019
Reveal.js - per-slide theme override using data-theme attribute
View reveal per-slide theme override.js
// the code below can be added to the end of your Reveal slide deck to implement
// per slide theme setting via the data-theme attribute
// I put this in right below the call to Reveal.initialize()
// the code is smart enough to restore the previous default theme
// (or slide specific theme) as you move forward and backward
// it also takes into account vertical slide stacks with a data-theme
// attribute on the outer <section> tag and allows individual vertical
// slides to specify their own override
You can’t perform that action at this time.