Skip to content

Instantly share code, notes, and snippets.

View dcm's full-sized avatar
😎

DCM dcm

😎
View GitHub Profile
@dcm
dcm / git-ignore.sh
Created August 6, 2022 04:03
Git alias to pull entries to be added to .gitignore based upon the topic (e.g. python, visualstudiocode, etc.)
#!/usr/bin/env bash
ARGS="$@";
if [ -z "$ARGS" ]; then ARGS=list; fi;
CARGS=$(echo "$ARGS" | sed -E "s/ +/,/g");
curl -sL "https://www.toptal.com/developers/gitignore/api/$CARGS";
@dcm
dcm / setup-ssl.sh
Created December 10, 2021 03:31
Quickly generate a CA and signed client/server keypairs
#!/usr/bin/env bash
set -e
set -o pipefail
FORCE=0
function ckfiles() { ck -f $@; }
function ckdirs() { ck -d $@; }
function ck() {
local x
local txt=" "
@dcm
dcm / android12.dockerfile
Last active November 23, 2021 14:02
BETA: Base Dockerfile for developing on Android 12 (API level 31), in VSCode with GrapheneOS, in particular.
# [Choice] Ubuntu version: bionic, focal
ARG VARIANT="focal"
FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT}
# Guide for figuring out what to install:
## https://gist.github.com/mtsahakis/f7893e3b5f0785dd99f304b4822d9b61
# Installing `repo`
## https://source.android.com/setup/develop#installing-repo
# Android version -> API level mapping:
## https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels
#!/usr/bin/env bash
set -e
YR=$(date +%Y)
MTH=$(date +%m)
DSTDIR="${1:-${HOME}/.geoip}"
OLDDIR="${2:-${DSTDIR}/.old}"
BURL="https://download.db-ip.com/free"
mkdir -p "${DSTDIR}" "${OLDDIR}"
@dcm
dcm / git-license.sh
Last active August 6, 2022 04:00
Git alias to pull a license's text by name
#!/usr/bin/env bash
DBG="${DBG:-0}";
PRNT_LABEL=0;
URL="https://raw.githubusercontent.com/spdx/license-list-data/master/json/licenses.json";
function run_prechecks() {
# is jq installed
if ! type jq &>/dev/null; then
echo "Download 'jq'";