Skip to content

Instantly share code, notes, and snippets.

🤗
free hugs

todgru

🤗
free hugs
Block or report user

Report or block todgru

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@todgru
todgru / get.js
Created May 21, 2020
vanilla javascript version of lodash get
View get.js
/**
* The behaves the same as the lodash version https://www.npmjs.com/package/lodash.get
*
* Source: https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_get
*/
const get = (obj, path, defaultValue = undefined) => {
const travel = regexp =>
String.prototype.split
.call(path, regexp)
.filter(Boolean)
@todgru
todgru / principles.md
Last active May 15, 2020
software guideline principles for a lazy programmer
View principles.md

Principles for lazy programmers

ongoing list that is sure to change.

setting: you can't show someone the light if they don't open their eyes. know when to shutup.

  1. single responsibility
  2. well written code should make tests easy to write
  3. explicit is better than implicit, except when its not
  4. YAGNI (You Aren't Gonna Need It)
@todgru
todgru / post-receive
Created Apr 28, 2020 — forked from tlrobinson/post-receive
Super simple git post-receive hook for Node.js + nvm + npm + node-foreman + init (Ubuntu) deployment
View post-receive
#!/usr/bin/env bash
set -u
set -e
export GIT_WORK_TREE="/var/www/example.com"
export NODE_VERSION="0.10"
echo "--> Checking out..."
git checkout -f
@todgru
todgru / git-deployment.md
Last active Apr 28, 2020 — forked from noelboss/git-deployment.md
Simple automated GIT Deployment using Hooks. Example to copy dist distribution directory.
View git-deployment.md

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

@todgru
todgru / maupin-chirp.csv
Last active May 26, 2020
maupin area chirp repeaters, uppercase names for because the Yaesu FT70-DR will not display lower case
View maupin-chirp.csv
Location Name Frequency Duplex Offset Tone rToneFreq cToneFreq DtcsCode DtcsPolarity Mode TStep Comment
1 146.52 146.52000 0.00000 Tone 82.5 88.5 023 NN FM 0 nat calling
2 146.46 146.46000 0.60000 Tone 82.5 88.5 023 NN FM 0 overland
3 TIMBERLINE 147.12000 + 0.60000 Tone 100.0 100.0 023 NN FM 5 Timberline
4 DUFER/TYGH RIDGE 147.26000 + 0.60000 Tone 82.5 88.5 023 NN FM 5 Dufur, Tygh Ridge
5 DALLESTHE 146.74000 - 0.60000 Tone 100.0 88.5 023 NN FM 5 The Dalles
6 HOOD RIVER 145.15000 - 0.60000 Tone 94.8 88.5 023 NN FM 5 Hood River, Mount Defiance
7 HOOD RIVER 147.10000 + 0.60000 Tone 100.0 100.0 023 NN FM 5 Hood River, Mount Defiance
8 FOSSIL 146.68000 - 0.60000 Tone 162.2 88.5 023 NN FM 5 Fossil, Snowboard Ridge
9 REDMOND 145.13000 - 0.60000 DTCS 88.5 88.5 026 NN FM 5 Redmond, Cline Butte
@todgru
todgru / raw-nest-true.md
Created Apr 21, 2020
sequelize nest raw
View raw-nest-true.md

Returns an undecorated sequelize instance. this should work for many model methods.

const result = await model.findByPk(1, { raw: true, nest: true }
@todgru
todgru / size.sql
Created Apr 21, 2020
display size of postgres database and table
View size.sql
SELECT pg_size_pretty (
pg_total_relation_size ('"camelCaseTableName"')
);
SELECT pg_size_pretty (
pg_database_size ('lowercaseddbname')
);
@todgru
todgru / remote-office-not-required-my-take-home-points.md
Last active Apr 8, 2020
Remote, Office Not Require - summary of points that stood out for me
View remote-office-not-required-my-take-home-points.md

Remote, Office not Required https://basecamp.com/books/remote

1. If I can't see them, how do I know they're working?

(pg 54) People have amazing ability to live down to low expectations, or live up to high expectations. If there are trust issues with employees, then the employer made poor hiring decision. Employer/Employee trust is fundamental.

2. People’s homes are full of distractions

(pg 58) being easily distracted from work could mean the work is not well defined or the task is menial, pointless. Might be a chance that if someone feels like this, others on the team might feel the same.

@todgru
todgru / vpn-in-a-vpn.md
Last active Nov 15, 2019
vpn route through another vpn pihole pivpn dnsmasq openvpn
View vpn-in-a-vpn.md

Vpn-ception

Ideally, I like to run one vpn. I have OpenVPN/PiVPN working just fine.

On the PiVPN server, I'd like to run a VPN client to my work office.

It's difficult to get Cisco VPN client and Tunnelblick clients running side-by-side on the same machine, ie my local dev machine, without a seeming hack(see below).

I have it working locally.

  • Cisco AnyConnect Client connect to work VPN. Only specific resources are made available. All other traffic is routed as normal.
@todgru
todgru / full-object-logging.js
Created Oct 9, 2019
javascript display entire object without truncating object depth
View full-object-logging.js
// to log an entire object without trucated depth:
console.dir(myDeeplyNestedObject, { depth: null });
You can’t perform that action at this time.