Skip to content

Instantly share code, notes, and snippets.


Kyle Barron kylebarron

Block or report user

Report or block kylebarron

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
View map.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
kylebarron /
Last active Oct 6, 2019
Starter code for new DO droplet
  1. Log on with ssh root@<public ip>.
  2. Add new user with adduser <username>.
  3. Give that new user sudo permissions with usermod -aG sudo <username>
  4. Copy ssh keys from root user to new user
    mkdir /home/<username>/.ssh
    cp ~/.ssh/authorized_keys /home/<username>/.ssh/
    chown <username> /home/<username>/.ssh/authorized_keys
  5. Log out and log on with that new user ssh <username>@<public ip>
kylebarron /
Created Apr 1, 2019 — forked from pix0r/
Use wget to scrape all URLs from a sitemap.xml Usage:
if [ "$SITEMAP" = "" ]; then
echo "Usage: $0"
exit 1
XML=`wget -O - --quiet $SITEMAP`
kylebarron /
Created Mar 30, 2019
Using LVM; My Setup
title date author
Using LVM; My Setup
August 11, 2017
Kyle Barron

TODO: Create personal_backup folder and logical volume on bulk_hdd. This is for non-current tasks which I don't want to have on my NVME.

My Personal LVM Setup

kylebarron /
Last active Mar 27, 2019
HN Archiving with ArchiveBox
#! /usr/bin/env python3
import requests
r = requests.get('')
top_ids = r.json()[:40]
url_scrape_list = ['']
for hn_id in top_ids:
hn_comment_url = f'{hn_id}'
kylebarron /
Created Feb 14, 2019
Combine Halfmile GPX segments into one or a few big GPX files
#! /usr/bin/env python3
Program: Combine Halfmile GPX tracks into a single GPX track
Author: Kyle Barron
import io
import requests
import gpxpy
import gpxpy.gpx
kylebarron /
Created Oct 19, 2018 — forked from XVilka/
True Colour (16 million colours) support in various terminal applications and terminals

Colours in terminal

It's a common confusion about terminal colours... Actually we have this:

  • plain ascii
  • ansi escape codes (16 colour codes with bold/italic and background)
  • 256 colour palette (216 colours + 16 ansi + 24 gray) (colors are 24bit)
  • 24bit true colour ("888" colours (aka 16 milion))
printf "\x1b[${bg};2;${red};${green};${blue}m\n"
View tmux-cheatsheet.markdown

Printable version. Just delete this line and use pandoc tmux-cheatsheet.markdown -o tmux.pdf -V geometry="margin=1in"

tmux shortcuts & cheatsheet

kill session:

tmux kill-session -t myname


kylebarron /
Created Aug 7, 2018 — forked from mcaceresb/
Delete all comments from a Stata do file
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# TODO: Comment code; include regexp? explanations
# TODO: parse with delimit in separate file; note this is imperfect. It
# has to be because of the way it works, which is super messy (specially
# for multi-line strings; i.e. stuff in quotes spanning many lines).
# TODO: scan code for `/*/`, `*/*`, and similar constructs. 'Please open
kylebarron /
Created Jul 24, 2018
Check Stata log for errors and issue a non-zero return code if an error occurred.
#! /usr/bin/env bash
# Check Stata log for errors and issue a non-zero return code if an error
# occurred.
# The idea for this came from
# Accepts either:
# a single argument, the log file
# the log file piped to stdin
You can’t perform that action at this time.