Skip to content

Instantly share code, notes, and snippets.

todgru /
Last active Nov 18, 2020
The idea of a "peer review" can be applied in just about any line of work. For me it's software.

Peer Review

One of the ways I've grown as programmer is by applying suggestions given to me in peer reviews. I've often learned more by feedback given in these reviews than any google or stackoverflow search could have taught.

Unless there is a misunderstanding of the intent of the code, most of the time, the suggestions should be taken to heart. The suggestions are made to help support future maintenance, make the code easier to understand, and almost always a general improvement to the final product. It is very, very rare for a suggestion to be made based purely on an arbitrary point of view made solely for the sake of commenting.

When suggestions are made for changes to my work, it provides me an opportunity to take a second look at my work and attempt to make the work better. Often times, these suggestions are usable in any future work I do. Now the reviewer doesn't need to continue to make the same suggestions with each review. This makes their job much easier - and mine to - because I no longer get


merge, squash, all commits of the feature-branch into the current branch.

git merge --squash feature-branch
git commit
todgru /
Created Nov 13, 2020
postgres insert into from select using on conflict, where conflict_target is an index_expression

Postgres ON CONFLICT conflict_target index_expression

On my new_users table, I have a unique index on email and account where the deleted_at value is null. This allows only one combination of email and account for any row where deleted_at is null.

I want to move those old_user rows to a new_users table, but since the old_users table may have duplicate account/email combinations, I want to ignore them.

This query will essentially "upsert" the data from old_users to new_users. If there are any violation of the unique index for a particular row, that row will be ignored.

todgru /
Created Sep 30, 2020
create a new sd card image for a raspberry pi using a raspberry pi

Create Raspberry Pi Image using a Raspberry Pi

My 2019 Macbook Pro w/Catalina 10.15.6 will not write to micro sd cards with any of the adapters I have available. They appear as "read only". OSX Disk Utility app will not format the SD cards. Error is Couldn't modify partition map. : (-69874)

To get around this, I used a Raspberry Pi to download the image and write it to the micro SD card.

I used a usb micro SD card reader from Canakit I inserted the USB/SD reader after the Pi booted.

For this example, I'm using an Ubuntu image. This will likely work for other Raspberry Pi images.

todgru /
Last active Sep 29, 2020
run simple git server on synology nas
# ./ <repo-name>
cd /volume1/homes/<username>/git-repos
git --bare init "$1".git
cd "$1".git
git update-server-info

Transparent Git Encryption

This document has been modified from its [original format][m1], which was written by Ning Shang ( It has been updated and reformatted into a [Markdown][m2] document by [Woody Gilk][m3] and [republished][m4].


When working with a remote git repository which is hosted on a third-party storage server, data confidentiality sometimes becomes

todgru /
Last active Sep 13, 2020
Setup Namecheap dns for github pages

At Namecheap, in the domains advanced dns settings, add A records and CNAME record. The CNAME will allow the to be redirected to the apex domain,

  • A record, host: @ value:
  • A record, host: @ value:
  • A record, host: @ value:
  • A record, host: @ value:
  • CNAME record, host: www value:

At Github, repo settings, set custom domain to, check "Enforce HTTPS".

todgru / chirp-20200902-oregon-idaho.csv
Last active Sep 2, 2020
20200902 chirp select repeaters for idaho and oregon. Should print this for reference. Name follows the format “RoadTown”. A “x” preface means its a YSF/C4FM/Wires repeater. Towns with many repeaters have extra letters after the road and before the town to help differentiate repeaters. Example “I84bPendleton”. And extra “u”’s indicates a UHF rep…
View chirp-20200902-oregon-idaho.csv
Location Name Frequency Duplex Offset Tone rToneFreq cToneFreq DtcsCode DtcsPolarity Mode TStep Comment
1 146.46 146.46000 0.00000 82.5 88.5 023 NN FM 0 overland
2 146.52 146.52000 0.00000 82.5 88.5 023 NN FM 0 nat calling
3 ID21PILOTPEAK 145.31000 - 0.60000 Tone 100.0 100.0 023 NN FM 5 145.3100 - 0.6 PL 100 VHF KA7ERV
4 ID75GALENA 147.14000 + 0.60000 Tone 100.0 100.0 023 NN FM 5 147.1400 + 0.6 PL 100 VHF AE6DX/R :Coverage from Twin Falls to Cape Horn above Stanley
5 ID75KETCHUM 147.18000 + 0.60000 Tone 100.0 100.0 023 NN FM 5 147.1800 + 0.6 PL 100 VHF N7ACB/R :Coverage from Twin Falls to Cape Horn above Stanley
6 ID55CASCADE 146.62000 - 0.60000 Tone 100.0 100.0 023 NN FM 5 146.6200 - 0.6 PL 100 VHF W7VOI :Net Thur@8pm
7 ID55MCCALL 147.02000 + 0.60000 Tone 100.0 100.0 023 NN FM 5 McCall, No Business Montain
8 XID55MCCALL 146.90000 - 0.60000 Tone 123.0 88.5 023 NN FM 5 146.9000 - 0.6 PL 123.0 Fusion AMS KC7MCC
9 ID55UMCCALL 442.50000 + 5.00000 Tone 100.0 100.0 023 NN FM 5 442.5000 + 5.0 UHF KC7MCC
todgru /
Last active Nov 29, 2020
Pi-star Notes: FCS YSF Wire-x room numbering C4FM reflectors
todgru / get.js
Created May 21, 2020
vanilla javascript version of lodash get
View get.js
* The behaves the same as the lodash version
* Source:
const get = (obj, path, defaultValue = undefined) => {
const travel = regexp =>
.call(path, regexp)
You can’t perform that action at this time.