Skip to content

Instantly share code, notes, and snippets.

@isopropylcyanide
isopropylcyanide / connector-hostname-death.json
Last active February 5, 2021 19:53
connector-hostname-death.json
{
"state": "FAILED",
"trace": "org.apache.kafka.connect.errors.ConnectException: The connector is trying to read
binlog starting at binlog file 'my-database-bin.000004', pos=654822673, skipping 20 events
plus 1 rows, but this is no longer available on the server. Reconfigure the connector to
use a snapshot when needed.",
"worker_id": "10.33.10.196:8083",
"generation": 121
@isopropylcyanide
isopropylcyanide / connector-update-fixing-rolled-over-binlogs-post.sh
Last active July 10, 2021 18:50
connector-update-fixing-rolled-over-binlogs-post.sh
# Current binlog = 1932
# Last binlog = 143
# Connector status: 131 < 143. So it is out of date
{"ts_sec":1610704790,"file":"my-database-bin.000004","pos":131,"row":1,"server_id":2001186,"event":2}
# Once you update the connector, it will take a snapshot and update to the earliest binlog
{"file":"my-database-bin.000004","pos":143}
# As it is processing the events and catches up, it will update the status.
@isopropylcyanide
isopropylcyanide / connector-update-fixing-rolled-over-binlogs.sh
Last active September 3, 2021 17:27
connector-update-fixing-rolled-over-binlogs.sh
curl -X PUT '{host}/connectors/{connector-name}/config' \
-H 'Content-Type: application/json' \
--data-raw '{
"name": "{connector-name}",
....
"snapshot.mode": "initial",
"table.whitelist": "T1,T2,T3",
"snapshot.select.statement.overrides": "T1",
"snapshot.select.statement.overrides.myDatabase.T1": "select * from T1 where created_at >= \"2021-02-01\"",
@isopropylcyanide
isopropylcyanide / mysql_query_optimizer_steps.json
Last active January 3, 2021 19:28
MySQL Query Tracer Optimiser Steps (Redacted response)
{
"steps": [
{
"join_preparation": {
"select#": 1,
"steps": [
{
"IN_uses_bisection": true
},
{
public enum ResponseCondition implements Predicate<Integer> {
ON_RESPONSE_4XX_5XX {
@Override
public boolean test(Integer responseCode) {
return responseCode >= 400 && responseCode <= 599;
}
},
ON_RESPONSE_4XX_5XX_NON_NOT_FOUND {
@Override
/**
* This class delays the logging of request and response events.
* @implNote This class uses a thread local to cache request serialization in the form of a builder
* If the response received from service passes the supplied predicate, then both request and response
* will be logged or else nothing will be logged.
*/
public class DelayedRequestResponseLoggingFilter implements ContainerRequestFilter, ContainerResponseFilter, WriterInterceptor {
private final ResponseCondition responseCondition;
/**
* This logging filter helps exclude logging requests and responses for URIs that match a set of excluded URIs
*/
public class WhitelistedServerLoggingFilter implements ContainerRequestFilter, ContainerResponseFilter, WriterInterceptor {
private final RequestResponseBuilder requestResponseBuilder;
private final Logger logger;
/**
* A get of paths for which the server request and response logging will not be performed
@isopropylcyanide
isopropylcyanide / docker-disk-prune.sh
Created June 3, 2020 06:58
Docker Disk Prune Cron Script
#!/bin/bash
# =====================================================================================================================
# This script helps prune docker disk for dangling images, unused containers or images. Use this in a cron tab for
# automatic disk maintenance. While this alone cannot clear most of the fragmented disk which are cleared by restaring
# the daemon, it only delays the point in time where we have to eventually restart the daemon and clear i-nodes
# Usage $ chmod +x docker-disk-prune.sh
# Recommended cron expression (every 3 hours)
# * */3 * * * sh /docker-prune.sh
@isopropylcyanide
isopropylcyanide / concurrent_cmd_bash.sh
Created March 21, 2020 15:06
Generic function that utilises function arguments to fire commands for a total of `N` times in `M` jobs at a parallel
# Generic function that utilises function arguments to fire commands for a total of `N` times in `M` jobs at a parallel
set -o xtrace
function conc(){
cmd=("${@:3}")
seq 1 "$1" | xargs -n1 -P"$2" "${cmd[@]}"
}
# $ conc N M cmd

Method 1

sudo /usr/local/McAfee/AntiMalware/VSControl stopoas

alternatively

sudo defaults write /Library/Preferences/com.mcafee.ssm.antimalware.plist OAS_Enable -bool False
sudo /usr/local/McAfee/AntiMalware/VSControl stop
sudo /usr/local/McAfee/AntiMalware/VSControl reload