Skip to content

Instantly share code, notes, and snippets.

J. Elliot Taylor jaytaylor

Block or report user

Report or block jaytaylor

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jaytaylor
jaytaylor / rm-and-preserve-parent-mtime.py
Last active Nov 17, 2018
Removes a file or directory while preserving the modification time (mtime) of the parent directory.
View rm-and-preserve-parent-mtime.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Removes a file or directory while preserving the modification time (mtime) of
the parent directory.
Pure-python implementation.
"""
@jaytaylor
jaytaylor / backup-andromeda-db.sh
Last active Nov 14, 2018
Utility for backing up a remote Andromeda Postgres DB. Preserves only the past X database dumps.
View backup-andromeda-db.sh
#!/usr/bin/env bash
##
# @author J. Elliot Taylor (@jaytaylor)
#
# @date 2018-11-14
#
# @description Andromeda postgres DB remote backup utility.
#
@jaytaylor
jaytaylor / ansi_terminal_color_codes_cleaner.go
Created Oct 31, 2018
ANSI terminal color-codes cleaner for Go.
View ansi_terminal_color_codes_cleaner.go
package main
import (
"fmt"
"io/ioutil"
"regexp"
"github.com/spf13/cobra"
)
@jaytaylor
jaytaylor / etc_systemd_system_boot-ntp-client.service
Created Oct 29, 2018
SystemD service to run NTP client on boot
View etc_systemd_system_boot-ntp-client.service
[Unit]
Description=NTP sync on boot
Wants=network-online.target
After=network.target network-online.target
[Service]
ExecStart=/sbin/ntpdate time.nist.gov
[Install]
WantedBy=multi-user.target
@jaytaylor
jaytaylor / java-tree.sh
Created Oct 18, 2018
Builds and prints java class dependency graph based on import references.
View java-tree.sh
#!/usr/bin/env bash
#
# Builds and prints java class dependency graph based on import references.
# Could be useful for extracting a portion of java files out of a project.
#
# Arg: <class-name>
#
# e.g. ./java-tree.sh CoreNLP/src TokenizerAnnotator
#
@jaytaylor
jaytaylor / ._README.md
Last active Sep 6, 2018
Manual Docker Distribution Registry Authentication & Token Acquisition / Usage
View ._README.md

Docker DTR V2 Distribution Registry: Manual Authentication

In this #HOWTO, we'll use a set of user:password credentials to obtain an auth token from an enterprise Docker Trusted Registry DTR (archived page snapshot of docs.docker.com/ee/dtr).

Required information

  • Registry hostname
  • Account username and password

Use credentials to obtain an auth token

@jaytaylor
jaytaylor / ._README.md
Last active Dec 3, 2019
Use google.com timestamp to set Linux system clock (useful when proxies prevent NTP
View ._README.md

set_system_clock_from_google.sh

Sets system time based on what is reported by google.com. Useful for cases where it is not possible to use the standard ntpdate command. For eample, if a Linux machine is on a network which is only able to reach the internet through an HTTP proxy.

Inspired by ryenus' answer @ https://superuser.com/a/807326/72342

Installation

# Download latest set_system_clock_from_google.sh script.
@jaytaylor
jaytaylor / gta-petstuffers-radio-ad-transcript.md
Created Aug 10, 2018
GTA PetStuffers Radio Ad Transcript
View gta-petstuffers-radio-ad-transcript.md

https://www.youtube.com/watch?v=6xpZbQsHSHU

Male: Oh Max, We go everywhere together,
      right boy?

Female: At Petstuffers we know there's
        nothing more then a relationship
        between man and his dog, sometimes
        you just can't let go.
@jaytaylor
jaytaylor / yaml2json.py
Created Aug 9, 2018
Python one-liner to convert YAML to JSON
View yaml2json.py
python -c 'import json, sys, yaml ; y = yaml.safe_load(sys.stdin.read()) ; print(json.dumps(y))'
You can’t perform that action at this time.