Skip to content

Instantly share code, notes, and snippets.

celesteking /
Last active January 31, 2024 16:31
vault list /pki/certs but with more info
# Enumerates vault /pki/certs outputting subject and SAN of certificates.
# openssl must be of latest version
vault list -format json /pki/certs | jq -r .[] | while read serial; do data=$(vault read -format=json pki/cert/$serial); (echo "$data" | jq -er '.data.revocation_time > 0 ' >/dev/null) && echo "******REVOKED*******" || echo "-------- OK --------"; echo $serial; echo "$data" | jq -r '.data.certificate' | openssl x509 -noout -nameopt RFC2253 -subject -enddate -ext subjectAltName 2>/dev/null; echo; done
celesteking /
Created January 19, 2024 00:15
JIRA to GITLAB issue migration script
# Stolen from some other guy
# Sniffs issues from old JIRA and tries to import them into GITLAB.
# Does comments, too.
# You've got to create additional user in gitlab called `defuser`.
# Make sure to make all users of respective gitlab project as owners, otherwise comment/issues time goes bonkers.
# Doesn't work with JIRA user/pass but instead requires a 'personal token'.
import requests
from requests.auth import HTTPBasicAuth
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
celesteking / pm2-myuser.service
Last active April 29, 2020 19:24
PM2 systemd unit file - under SCL
# put this into /etc/systemd/system/pm2-myuser.service , then `systemctl daemon-reload`
# `myuser` should be replaced with your username and `ExecXXX` params adjusted to relevant paths.
# This systemd unit file will spawn nodejs PM2 process manager.
# It's an adapted version of `pm2 startup` and contains proper things to use with latest systemd.
# This one uses nodejs from SCL (centos/redhat software collections) and allows you to get rid of error:
# systemd[1]: New main PID XXX does not belong to service, and PID file is not owned by root. Refusing.
# If you don't use SCL, just adjust `ExecXXX` params accordingly.
celesteking /
Last active February 21, 2020 14:47
Can't SSH out of gitlab/docker instance to remote host? "can't open /dev/tty: No such device or address"

Look no further! It's not a problem with you, it's a problem with SSH client. The issue is that your private key file is missing the trailing newline and ssh just can't understand that file thinking that it's been encrypted with a passprhase -- what a dork!

your debug output would be like this:

debug1: read_passphrase: can't open /dev/tty: No such device or address
debug2: no passphrase given, try next key
celesteking /
Last active May 12, 2020 20:20
spamassassin: what you need to know.

Fucking SA can't get their shitty doc right. Here's the proper doc.


score SYMBOLIC_TEST_NAME n.nn [ n.nn n.nn n.nn ]

Here's what these scores actually mean:

"query": {
"fields": "*"
hw-time system-time freq-offset-ppm tick
1429697045 1429697047.050365
1429697055 1429697057.051019 65 1
1429697065 1429697067.051488 56 1
1429697075 1429697077.051977 54 1
1429697085 1429697087.052447 52 1
1429697095 1429697097.052935 51 1
1429697105 1429697107.053420 51 1
1429697115 1429697117.053929 51 1
1429697125 1429697127.054369 50 1
$ mco rpc --no-progress --quiet mcb clear_expired -I /stage/ -v
warn 2014/11/17 15:15:44: base.rb:104:in `validate_requirements' DDL requirements validation being skipped in development
warn 2014/11/17 15:15:45: base.rb:104:in `validate_requirements' DDL requirements validation being skipped in development
Discovering hosts using the mc method for 2 second(s) .... 5
case override
when Array, String
hierarchy.insert(0, override)
when Hash
hierarchy.insert(override['position'].to_i, override['datasource'])