Skip to content

Instantly share code, notes, and snippets.

View kylebarron's full-sized avatar

Kyle Barron kylebarron

View GitHub Profile
@kylebarron
kylebarron / scrape-sitemap.sh
Created April 1, 2019 23:15 — forked from pix0r/scrape-sitemap.sh
Use wget to scrape all URLs from a sitemap.xml Usage: scrape-sitemap.sh http://domain.com/sitemap.xml
#!/bin/sh
SITEMAP=$1
if [ "$SITEMAP" = "" ]; then
echo "Usage: $0 http://domain.com/sitemap.xml"
exit 1
fi
XML=`wget -O - --quiet $SITEMAP`
@kylebarron
kylebarron / lvm_personal.md
Created March 30, 2019 00:53
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
kylebarron / hn_archive.py
Last active March 27, 2019 18:58
HN Archiving with ArchiveBox
#! /usr/bin/env python3
import requests
r = requests.get('https://hacker-news.firebaseio.com/v0/topstories.json')
top_ids = r.json()[:40]
url_scrape_list = ['https://news.ycombinator.com']
for hn_id in top_ids:
hn_comment_url = f'https://news.ycombinator.com/item?id={hn_id}'
url_scrape_list.append(hn_comment_url)
@kylebarron
kylebarron / combine_halfmile_gpx.py
Created February 14, 2019 00:37
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
const { CompositeDisposable, Point, Range } = require('atom');
atom.commands.add('atom-text-editor', 'me:insert-number-list', () => {
var editor = atom.workspace.getActiveTextEditor();
var selections = editor.getSelections();
for (var i = 0; i < selections.length; i++) {
selection = selections[i]
selection.insertText(String(i + 1))
}
@kylebarron
kylebarron / parquet_build_linux.sh
Last active October 31, 2018 01:46
Script to build parquet-cpp with Arrow as a static dependency
#! /usr/bin/env bash
# Script to build parquet-cpp with Arrow as a static dependency
# Modified from:
# https://stackoverflow.com/questions/48157198/how-can-i-statically-link-arrow-when-building-parquet-cpp
mkdir -p parquet-cpp-deps
DEPDIR=$PWD/parquet-cpp-deps
git clone https://github.com/apache/parquet-cpp
@kylebarron
kylebarron / TrueColour.md
Created October 19, 2018 16:29 — forked from XVilka/TrueColour.md
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"
@kylebarron
kylebarron / tmux-cheatsheet.markdown
Last active August 13, 2018 15:36 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

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

Sessions

@kylebarron
kylebarron / deleteStataComments.py
Created August 7, 2018 16:56 — forked from mcaceresb/deleteStataComments.py
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
kylebarron / showload.sh
Last active August 6, 2018 15:46
showload on NBER server from local computer
#! /usr/bin/env bash
ssh barronk@age4.nber.org \
-o LogLevel=QUIET \
-t $'showload | sed -n \'/-----/,$p\' | sed -r \'/afserver|gruber|miller|sas|age8|age11|age12/d\' | sed -e \'/It might/,$d\''