Skip to content

Instantly share code, notes, and snippets.

Nicola Baisero nicStuff

Block or report user

Report or block nicStuff

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View js-array-reverse-bmark.js
// simple benchmark for reversing a string in js - source https://medium.com/quick-code/5-ways-to-reverse-a-string-in-javascript-466f62845827
function reverseFor(str){
let reversed = "";
for (var i = str.length - 1; i >= 0; i--){
reversed += str[i];
}
return reversed;
}
function reverseArray(str){
return str.split("").reverse().join("");
@nicStuff
nicStuff / redis-migrate.sh
Last active May 18, 2019
Comfort tool for migrating redis keys among instances. Supports KEYS syntax matching, authentication and TTL
View redis-migrate.sh
#!/bin/bash
######
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
# TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
######
@nicStuff
nicStuff / mifcs.rb
Last active Apr 12, 2019
Simple ruby script that renames all .jpg/.mov/.nef files in the given folder to a name containing the exif creation timestamp (for jpg/nef) and modification time (for mov). Scales images using imagemagick in a folder
View mifcs.rb
##########################################################################################################
##########################################################################################################
##########################################################################################################
###### Mass Image Filename Corrector and Scaler
##########################################################################################################
################################################ [rename] Renaming
######
###### Renames jpeg/nef/mov/mp4 files from xxxx.jpg, to a timestamp filename, like
###### 2015.05.28_15.33.22.jpg, using the date in exif field Exif.Photo.DateTimeOriginal for
###### images, and using file modification time for .mov/.mp4
View Simple floating point safe multiplication method
Math.mult = function(a, b) {
var aSplitted = a.toString().split('.');
var bSplitted = b.toString().split('.');
var aDelta = (aSplitted[1] ? aSplitted[1] : "").length;
var bDelta = (bSplitted[1] ? bSplitted[1] : "").length;
// a * b
return ((a * Math.pow(10, aDelta)) * (b * Math.pow(10, bDelta))) / (Math.pow(10, aDelta) * Math.pow(10, bDelta));
};
You can’t perform that action at this time.