Skip to content

Instantly share code, notes, and snippets.

View peterwwillis's full-sized avatar

Peter W peterwwillis

View GitHub Profile
@peterwwillis
peterwwillis / sample.sh
Created May 8, 2019 14:27
Changing linux terminal screen window and tab titles
echo -ne "\033]0;This changes the window title\007"
echo -ne "\ekThis changes the tab title\e\\"
@peterwwillis
peterwwillis / get_all_gitlab_repos.sh
Created April 2, 2019 14:49
Get all GitLab repositories using the GitLab API
#!/usr/bin/env bash
# Get all GitLab repositories from the GitLab API.
GITLAB_HOST="https://gitlab.com"
export TOKEN=$(cat ~/.gitlab-token)
API_VER="v4"
PER_PAGE=100
set -eo pipefail
#!/bin/sh
# Exports your bookmarks.html and converts them to a simple text file, one URL per line
BOOKMARKS_FILE="$1"
cat "$BOOKMARKS_FILE" | grep HREF | sed -e 's/^.*HREF="\([^"]*\)".*$/\1/ig' | grep -i ^http | sort -u > httrack-bookmarks.txt
# Get all bookmarks with httrack.
# NOTE: this disables all of httrack's "safety features"
httrack -O foo -i -iC2 -c20 -%c200 -%! -r1 -n -%k -%L httrack-bookmarks.txt
#!/bin/bash
# Export your bookmarks into a bookmarks.html file and pass it to this script
BOOKMARKS_FILE="$1"
wget -v --tries=1 --convert-links --adjust-extension --page-requisites --no-parent --timestamping --no-remove-listing --no-clobber --force-html -i "$BOOKMARKS_FILE" 2>&1 | tee -a wget-mirror-bookmarks.log
@peterwwillis
peterwwillis / git-prune.sh
Created July 28, 2018 18:58
Prune Git's local orphan references, merged feature branches, remote tracking references, and more
#!/bin/bash
# Prune local orphan refs
git prune -v
# Deletes all stale (local) remote-tracking branches under origin.
# These stale branches have already been removed from the remote repository
# referenced by <name>, but are still locally available.
git remote prune origin