Skip to content

Instantly share code, notes, and snippets.

@jow-
jow- / pr.sh
Last active June 5, 2016 10:47
A script to merge PRs into local branches
#!/bin/bash
# Github repository, just the name/repo part, no .git suffix, no base url!
REPO="lede-project/source"
# Your repository token, generate this token at your profile page:
# - Navigate to https://github.com/settings/tokens
# - Click on "Generate new token"
# - Enter a description, e.g. "pr.sh" and pick the "repo" scope
# - Hit "Generate token"
@jow-
jow- / pr2patch.sh
Created June 5, 2016 10:45
A script to convert pull requests into patch files for git-am
#!/bin/sh
REPO=$1
PR=$2
PATCH=$3
URIS=$(curl -s https://api.github.com/repos/$REPO/pulls/$PR/commits | sed -ne 's|^.*"html_url": "\(.*/commit/.*\)",|\1.patch|p')
i=1
@jow-
jow- / sob2from.sh
Last active January 27, 2017 09:58
Rewrite the commit author to reflect whats in Signed-off-by
#!/bin/bash
git filter-branch -f --tag-name-filter cat --commit-filter '
eval $(git show --format=%B "$GIT_COMMIT" | sed -ne "s|Signed-off-by: \(.*\) <\(.*\)>$|SOB_AUTHOR='"'"'\\1'"'"'; SOB_EMAIL='"'"'\\2'"'"'|p" | head -n1)
if [ -n "$SOB_AUTHOR" -a -n "$SOB_EMAIL" -a "$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>" != "$SOB_AUTHOR <$SOB_EMAIL>" ]; then
echo -e "\nRewrite $GIT_COMMIT: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> => $SOB_AUTHOR <$SOB_EMAIL>" >&2
export GIT_AUTHOR_NAME="$SOB_AUTHOR"
export GIT_AUTHOR_EMAIL="$SOB_EMAIL"
@jow-
jow- / download.sh
Last active November 8, 2023 12:58
Script to perform a verified firmware download.
#!/usr/bin/env bash
# Script to perform verified file downloads.
# Exit codes:
# 0 - File downloaded successfully and verified
# 1 - Failed to download requested file
# 2 - Failed to download sha256sums file
# 3 - Failed to download sha256sums.gpg file
# 4 - GnuPG is available but fails to verify the signature (missing pubkey, file integrity error, ...)
# 5 - The checksums do not match
# 6 - Unable to copy the requested file to its final destination
@jow-
jow- / gist:920dfe708e8997e23f71ca453df54ed9
Last active October 11, 2020 13:45 — forked from weedy/gist:cb042f4a11d2a5f94d1b228820be9184
OpenWRT RTL8812AU Makefile
#
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# $Id$
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
@jow-
jow- / Makefile
Last active December 1, 2016 16:36
#
# Copyright (C) 2016 Dan Luedtke <[email protected]>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
include $(TOPDIR)/rules.mk
PKG_NAME:=jool
PKG_VERSION:=3.5.1
@jow-
jow- / maketag.sh
Last active October 2, 2017 17:05
#!/usr/bin/env bash
git_author="$(git config user.name)"
git_email="$(git config user.email)"
gpg_keyid=""
base_url="http://downloads.lede-project.org/releases"
[ -f "./feeds.conf.default" ] || {
echo "Please execute as ./${0##*/}" >&2
@jow-
jow- / make-changelog.pl
Last active October 2, 2017 17:16
Simple Perl script to generate a Git changelog in wiki markup format
#!/usr/bin/env perl
use strict;
use warnings;
use Text::CSV;
my $range = $ARGV[0];
unless (defined $range) {
printf STDERR "Usage: $0 range\n";
@jow-
jow- / dir-index.cgi
Created April 11, 2017 11:54
Directory listing script
#!/usr/bin/perl
use strict;
use warnings;
use Fcntl ':mode';
my $phys = $ENV{'DOCUMENT_ROOT'};
my $virt = '/'.$ENV{'PATH_INFO'};
@jow-
jow- / patchwork-apply.sh
Last active August 20, 2017 14:48
Script to fetch patchwork patch, apply it and confirm it in patchwork and via email.
#!/usr/bin/env bash
yesno() {
local prompt="$1"
local default="${2:-n}"
local input
while [ 1 ]; do
printf "%s y/n [%s] > " "$prompt" "$default"
read input