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 / 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"' _ {} \;
@craigvantonder
craigvantonder / git-compare-directories
Last active November 8, 2018 07:13
Using git to compare two directories for differences
// https://stackoverflow.com/a/7945988/2110294
git diff --diff-filter=M --name-status --no-index /compare/from /compare/to >> some_filename
@craigvantonder
craigvantonder / imagemagick-convert-images
Last active November 8, 2018 07:13
Convert images with imagemagick
mogrify -format jpg *.jpeg
@craigvantonder
craigvantonder / copyByFiletype.bat
Last active March 27, 2022 10:39
Windows batch file to recursively copy all files of a specific type to an output directory
@echo off
setlocal
set DIR=C:\path\from
set OUTPUTDIR=C:\path\to
for /R %DIR% %%G in (*.jpg *.jpeg) do copy "%%G" "%OUTPUTDIR%"
@craigvantonder
craigvantonder / test.php
Last active March 6, 2018 08:03
Test execution times of for and foreach in PHP
<?php
// Create fake data array of 10000 records
$max = 10000;
$rands = array();
for($i=0; $i<$max;$i++) {
$rands[$i]=mt_rand(0,$max-1);
}
$temp;
// Time foreach itteration