Skip to content

Instantly share code, notes, and snippets.

@april
april / git-log-json.sh
Last active December 20, 2023 13:11
pure shell function for git log as JSON
# attempting to be the most robust solution for outputting git log as JSON,
# using only `git` and the standard shell functions, without requiring
# additional software.
# - uses traditional JSON camelCase
# - includes every major field that git log can output, including the body
# - proper sections for author, committer, and signature
# - multiple date formats (one for reading, ISO for parsing)
# - should properly handle (most? all?) body values, even those that contain
# quotation marks and escaped characters
@m-radzikowski
m-radzikowski / script-template.sh
Last active May 4, 2024 04:13
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@RulerOf
RulerOf / README.md
Last active November 30, 2022 21:20
Dynamic DNS Script I used for Google Domains with DD-WRT

DD-WRT Dynamic DNS for Google Domains

Create a Synthetic Record for Dynamic DNS. Copy the script and substitute your synthetic record's username, password, and FQDN in the config section.

Go to Administration > Commands tab and paste the code into the Command box, then click Save Custom Script.

Go to Administration > Management tab. Scroll down to the Cron section, and toggle Cron: Enable

In the Additional Cron Scripts section, put:

@MirkoManojlovic
MirkoManojlovic / GnuPG-2.2.md
Last active February 8, 2022 22:08 — forked from simbo1905/GnuPG-2.2.md
Build/install instructions for GnuPG 2.2.x on Centos 7 and similar distros (formerly for 2.1.x)

GnuPG 2.2.x Build Instructions

Below are my build instructions for GnuPG 2.2.20, released on April 1st, 2020. These instructions are built for a headless Centos 7 LTS server (specificaly the offical centos docker image https://hub.docker.com/_/centos).

You use the below install script to install GnuPG 2.2.x by running the following commands:

# if you are root in a docker image:
curl -OL "https://gist.githubusercontent.com/MirkoManojlovic/56f563271eca43c67606b5991f32edd4/raw/1358b87214312e41fd2e28a49a34869a699fb06f/install-gnupg22.sh" && bash ./install-gnupg22.sh
# else if you need to sudo to do the installs:
@calexandre
calexandre / merge-zsh-history.sh
Last active May 9, 2024 15:56
Merge two zsh history files
#!/bin/bash
# Inspired on https://david-kerwick.github.io/2017-01-04-combining-zsh-history-files/
set -e
history1=$1
history2=$2
merged=$3
echo "Merging history files: $history1 + $history2"
test ! -f $history1 && echo "File $history1 not found" && exit 1
@galan
galan / import-letsencrypt-java.sh
Last active August 17, 2023 17:12
Imports the letsencrypt certificates into the java keystore
#!/bin/bash -e
# JAVA_HOME can be passed as argument if not set
if [ ! -d $JAVA_HOME ]; then
JAVA_HOME=${1}
fi
KEYSTORE=$JAVA_HOME/jre/lib/security/cacerts
if [ ! -f "$KEYSTORE" ]; then
echo "Keystore not found in '$KEYSTORE'"
exit 1
@sginkov
sginkov / Chef solo usage example(Berkshelf, Vagrant).md
Last active September 27, 2018 20:18
Chef solo usage example(Berkshelf, Vagrant)

Installation steps to use chef scripts

1. Install ruby

2. Added Gemfile with kinfe-solo

source "https://rubygems.org"
gem "knife-solo"
gem "berkshelf"
@hubgit
hubgit / curl-verbose.php
Created December 2, 2011 16:40
Verbose cURL in PHP
<?php
// Request URL
$url = 'http://www.google.com/';
// HTTP headers
$headers = array(
//'Content-Type: application/json',
//'Accept: application/json',
);