- Log on with
ssh root@<public ip>
. - Add new user with
adduser <username>
. - Give that new user sudo permissions with
usermod -aG sudo <username>
- 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
- Log out and log on with that new user
ssh <username>@<public ip>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
SITEMAP=$1 | |
if [ "$SITEMAP" = "" ]; then | |
echo "Usage: $0 http://domain.com/sitemap.xml" | |
exit 1 | |
fi | |
XML=`wget -O - --quiet $SITEMAP` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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 |
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"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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 | |
# https://gist.github.com/pschumm/b967dfc7f723507ac4be | |
# Accepts either: | |
# a single argument, the log file | |
# the log file piped to stdin |