Skip to content

Instantly share code, notes, and snippets.

todgru

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 / dns-troubleshooting.md
Last active Oct 18, 2019
setting up dnsmasq on raspberry pi nmap ports dns
View dns-troubleshooting.md

Local DNS dnsmasq

Use case

I wanted to have an outside domain name resolve to a computer inside my local private network. I am tyring out duckdns.org to handle the resolution. The DNS resolves fine outside of my local network, yet locally the fqdn will not resolve. To enable this, a local dns needs to handle the request, routing to the local server.

This is where the raspberry pi dns comes in. I'm running Raspbian GNU/Linux 9 (stretch), a Debian variant. http://www.raspbian.org/

NOTE

I have been unable to get dnsmasq to start correctly on reboot. Nothing stands out in daemon.log. sudo service dnsmasq status shows one particular line that is different from the status of a reboot vs a manual service restart:

@todgru
todgru / starttmux.sh
Last active Oct 17, 2019
Start up tmux with custom windows, panes and applications running
View starttmux.sh
#!/bin/sh
#
# Setup a work space called `work` with two windows
# first window has 3 panes.
# The first pane set at 65%, split horizontally, set to api root and running vim
# pane 2 is split at 25% and running redis-server
# pane 3 is set to api root and bash prompt.
# note: `api` aliased to `cd ~/path/to/work`
#
session="work"
View aws-ec2-redis-cli.md
@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 });
View sunrise-sunset-algorithm.txt
From: https://edwilliams.org/sunrise_sunset_algorithm.htm
Sunrise/Sunset Algorithm
Source:
Almanac for Computers, 1990
published by Nautical Almanac Office
United States Naval Observatory
Washington, DC 20392
Inputs:
@todgru
todgru / ssh-tunnel.md
Last active Aug 28, 2019
How to set-up a SSH tunnel for AWS RDS
View ssh-tunnel.md

SSH Tunnel

Our db is hosted on Amazon. Our web server can connect to the db. Connections to the db are not allowed outside of the web server.

Run ssh tunnel locally:

This creates a tunnel from my local machine to the web server:

ssh -N -L 3307:my-rds-db.us-east-1.rds.amazonaws.com:3306 ec2-my-web-server.compute-1.amazonaws.com
@todgru
todgru / rebase.md
Last active Jul 25, 2019
git rebase interactive remove commit
View rebase.md

#git rebase -i <sha>

List of commits from git log

F--E--D--C--B--A

Lets say you want to remove commit D from the commits.

git rebase -i E
View iterator.js
const arr = [1, 2, 3, 4, 5, 6];
const iter = arr[Symbol.iterator]();
const foo = i => {
const v = i.next();
if (v.done) return "done!";
console.log("next!", v.value);
return foo(i);
};
foo(iter);
@todgru
todgru / rpi3-bt-keyboard.txt
Created Jun 30, 2019 — forked from tekemperor/rpi3-bt-keyboard.txt
Connect Apple Wireless Keyboard to Raspberry Pi 3 in Raspbian
View rpi3-bt-keyboard.txt
sudo service bluetooth status # Verify bluetooth is active.
sudo bluetoothctl # Lauch bluetooth subshell.
agent on # [No idea what this does.]
default-agent # [No idea what this does.]
scan on # Displays a list of available devices.
pair XX:XX:XX:XX:XX:XX # This prepares a potential connection, the X's represent your device ID
# A "PIN code" will be displayed, type it on the keyboard and press "enter".
trust XX:XX:XX:XX:XX:XX # Adds device to trusted devices, this survives reboot.
connect XX:XX:XX:XX:XX:XX # Connect to the device now.
exit # Return to previous shell.
@todgru
todgru / ssh.md
Last active Jun 19, 2019
enable ssh on raspberry pi raspian fresh install etcher OS X Mac network cable direct connect
View ssh.md
  • after image is flashed using Etcher, cd /Volumes/boot.
  • Then add ssh file to root. touch ssh.
  • connect network cable between os x computer and raspberry pi. boot the raspberry pi.
  • wait a minute.
  • then ssh pi@raspberrypi.local

That's it. No need for a screen, keyboard or any other device to get into the pi. :)

You can’t perform that action at this time.