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 / 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
@craigvantonder
craigvantonder / gist:a54702cd9bd5c2dd6e8b33c3fce8bc5b
Last active July 26, 2021 17:25
Sublime Text 3 / Network Folder - inotify_add_watch failed: No space left on device
Takes a long time to load project folders running in a VM and the sublime console shows:
inotify_add_watch failed: No space left on device (path: /some/project/location/...)
https://github.com/google/cadvisor/issues/1581#issuecomment-367616070
sudo cat /proc/sys/fs/inotify/max_user_watches # default is 8192
sudo sysctl fs.inotify.max_user_watches=1048576 # increase to 1048576
https://github.com/google/cadvisor/issues/1581#issuecomment-436405681
@craigvantonder
craigvantonder / bash-change-extension-recursively
Created November 8, 2018 07:26
Change the extension of files recursively
find /path/to -depth -name "*.jpeg" -exec sh -c 'mv "$1" "${1%.jpeg}.jpg"' _ {} \;