Skip to content

Instantly share code, notes, and snippets.

View craigvantonder's full-sized avatar

Craig van Tonder craigvantonder

  • South Africa
View GitHub Profile
@craigvantonder
craigvantonder / mysql-connection-ciphers.md
Created November 30, 2024 22:04
Show active connections along with their ciphers in MySQL.

Sometimes it can be useful to know which ciphers certain connections are utilising, this will how you the active connections along with their ciphers if applicable.

Reference: https://security.stackexchange.com/a/260139/40579

SELECT t.THREAD_ID,
       t.PROCESSLIST_USER,
       t.PROCESSLIST_HOST,
       t.CONNECTION_TYPE,

sbt.VARIABLE_VALUE AS cipher

@craigvantonder
craigvantonder / mysql-general-log.md
Last active December 1, 2024 10:27
Enable, view and disable the general logging in MySQL.

Sometimes it is useful to enable query logging for debugging purposes, this will log all queries so that you can see which users are doing what.

Turn it on (https://stackoverflow.com/a/14404000/2110294)

SET global general_log = on;
SET global log_output = 'table';

List logs

SELECT * FROM mysql.general_log;

@craigvantonder
craigvantonder / unbound-cheat-sheet.md
Created November 10, 2024 18:15 — forked from f9n/unbound-cheat-sheet.md
Unbound Cheat Sheet

Unbound Cheat Sheet

Installation

$ yum install -y unbound

Setup SSL keys for unbound-control

@craigvantonder
craigvantonder / implementation.rs
Created November 10, 2024 01:35 — forked from ansrivas/implementation.rs
Rust tokio-postgres example custom ToSql and FromSql implementation
use postgres_types::{Type, ToSql, FromSql, IsNull, to_sql_checked};
use bytes::BytesMut;
use std::error::Error;
#[derive(Debug)]
struct RawValue<'a> {
type_: Type,
raw: Option<&'a [u8]>,
}
@craigvantonder
craigvantonder / nc-udp-port-check.md
Last active August 31, 2024 09:34
Check if a remote UDP port is open/closed

On the remote machine, listen on a specific port:

nc -vul 1234

On the host machine, connect to the same port:

nc -u the.remote.ip.addr 1234

Then still on the host you can type anything, i.e. hello and press enter. On the on the remote machine you will see:

# Eternal bash history.
# ---------------------
# Undocumented feature which sets the size to "unlimited".
# http://stackoverflow.com/questions/9457233/unlimited-bash-history
export HISTFILESIZE=
export HISTSIZE=
export HISTTIMEFORMAT="[%F %T] "
# Change the file location because certain bash sessions truncate .bash_history file upon close.
# http://superuser.com/questions/575479/bash-history-truncated-to-500-lines-on-each-login
@craigvantonder
craigvantonder / path_Application_start.md
Last active September 1, 2022 23:23
Pixeluvo / Ubuntu 22.04 / Auto configuration failed

May 19 2022

Attempting to download the application at http://www.pixeluvo.com/download/ whilst using Ubuntu 22.04, the user is prompted:

Download the Pixeluvo installer for Windows (Please note we are not able to offer a Linux version at this time)

Having obtained a paid licence (absolutely worth it) and the 1.6 deb file with the application installed, when attempting to run the application:

$ pixeluvo

@craigvantonder
craigvantonder / readme.md
Created August 21, 2021 12:59
Linux / Sublime Text / NVM / SublimeLinter / SASS / jshint / sass-lint

I am using NodeJS in Ubuntu via NVM and was having and issue with sass-lint in Sublime Text 3, the console shows:

SublimeLinter: WARNING: sass cannot locate 'sass-lint'
Please refer to the readme of this plugin and our troubleshooting guide: http://www.sublimelinter.com/en/stable/troubleshooting.html

Reading the issue on the source repository over here: SublimeLinter/SublimeLinter#128 (comment)

Means that we can do the following in the user configuration for SublimeLinter:

{

@craigvantonder
craigvantonder / async.js
Last active August 24, 2021 05:42
Async function handling examples
// https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Asynchronous/Introducing
var inputString = 'Hello World';
function callbackStyleFunction (input, cb) {
//if (someErrorCondition) return cb('something bad happened');
cb(null, input);
};
const promiseStyleFunction = function (input) {
return new Promise(function (resolve, reject) {
@craigvantonder
craigvantonder / test.sh
Created March 12, 2020 00:00
Two ways to check if a SSH control socket is open in BASH
#!/bin/bash
# How can I fully log all bash scripts actions?
# https://serverfault.com/a/103569/210437
if test -S "/absolute/path/to/ssh_control_socket"; then
echo 'It exists'
fi
# Why can't bash recognize the existence of a socket file