Skip to content

Instantly share code, notes, and snippets.

@rindeal
rindeal / gist:8c862f576036dd58e46d
Created September 19, 2014 16:25
Github Bigquery - get all merged PR's of a specific user
SELECT created_at,
repository_name,
payload_pull_request_title,
payload_pull_request_issue_url ,
repository_description,
repository_language,
repository_url
FROM [githubarchive:github.timeline]
WHERE TYPE="PullRequestEvent"
AND payload_pull_request_head_repo_owner_login="USERNAME"
@rindeal
rindeal / opkg-link.sh
Created November 11, 2014 12:53
OpenWrt external storage package linker
@rindeal
rindeal / process-tmpl.sh
Last active August 29, 2015 14:11
pure BASH template processor
#!/bin/bash
# http://stackoverflow.com/a/2916159/2566213
PATTERN=(.*)(\$\{([a-zA-Z_][a-zA-Z_0-9]*)\})(.*)
line="$(cat; echo -n a)"
end_offset=${#line}
while [[ "${line:0:$end_offset}" =~ $PATTERN ]] ; do
PRE="${BASH_REMATCH[1]}"
@rindeal
rindeal / dnsmasq-info.sh
Last active September 30, 2015 10:57
Script to retrieve info about a dnsmasq instance
#!/bin/sh
# usage:
# - $0 # queries the default server
# - $0 NAMESERVER_IP # queries the provided server
# ------------------------------------------------------------------------------
# Example output:
# dnsmasq : 127.0.1.1
# servers : 8.8.8.8#53 216 1 # template: "IP#port valid_responses invalid_responses"
# cachesize : 10000
# insertions: 9876
@rindeal
rindeal / matrixish.sh
Created November 6, 2015 13:11
Matrixish
#!/bin/bash
#
# matrix: matrix-ish display for Bash terminal
# Author: Brett Terpstra 2012 <http://brettterpstra.com>
# Contributors: Lauri Ranta and Carl <http://blog.carlsensei.com/>
#
# A morning project. Could have been better, but I'm learning when to stop.
### Customization:
blue="\033[0;34m"
@rindeal
rindeal / clear_cache.sh
Last active December 3, 2015 22:36
OpenCart (vqMod) toolbox
#!/bin/bash
# Clear OpenCart (vqMod) caches
rm -rf ./system/cache/{cache*,smp/*}
rm -rf ./vqmod/vqcache/*
rm -f ./vqmod/*.cache
@rindeal
rindeal / find_outdated_desktop_files.sh
Last active March 4, 2016 14:15
Find outdated .desktop files
#!/bin/bash -
grep -a -r -P -o '(?:(?<=Exec=)([^"]\S+)|(?<=Exec=")(\S+)(?="))' \
-- /{usr,home/*/.local}/share/applications | sort -u | \
while read m; do
desktop_file="${m%:*}"
exec_name="${m##*:}"
if ! command -v "$exec_name" 2>&1 >/dev/null; then
echo "$desktop_file|$exec_name"
@rindeal
rindeal / wrapper.sh
Last active March 13, 2016 19:09
ar/nm/ranlib wrapper for LTO
#!/bin/sh
DEBUG=0
[ "${DEBUG}" -eq 1 ] && set -x
CC=${CC:-"/usr/bin/gcc"}
lto_wrapper="$( $CC -v 2>&1 | /bin/awk -F= '/COLLECT_LTO_WRAPPER/{print $2}' )"
plugin_dir="${lto_wrapper%/*}"
util="${0##*/}"
@rindeal
rindeal / df-him.png
Last active July 16, 2016 17:01
Colorized `df -h` and `df -hi` merged together -> df -hi(mproved)
df-him.png
@rindeal
rindeal / stack.sh
Last active July 29, 2016 23:13 — forked from bmc/stack.sh
A stack implementation, in bash
#!/bin/bash
# A stack, using bash arrays.
#
# Based on: https://gist.github.com/bmc/1323553 by Brian Clapper (bmc) <bmc@clapper.org>
# ---------------------------------------------------------------------------
# Check if a stack exists
#
# Usage: stack_exists name