Skip to content

Instantly share code, notes, and snippets.

View RazerMoon's full-sized avatar
🐢
Slowly getting there...

Rasync RazerMoon

🐢
Slowly getting there...
  • Ireland
View GitHub Profile
@ppseprus
ppseprus / entropy-in-short.js
Last active February 27, 2022 14:19 — forked from jabney/entropy.js
Javascript implementation of a Shannon entropy calculation in bits per symbol
// Shannon entropy
const entropy = str => {
return [...new Set(str)]
.map(chr => {
return str.match(new RegExp(chr, 'g')).length;
})
.reduce((sum, frequency) => {
let p = frequency / str.length;
return sum + p * Math.log2(1 / p);
}, 0);
@asdfman
asdfman / batch-drop-shadow.scm
Created April 29, 2012 08:16
Simple GIMP script for applying filters to an entire batch of (Shimeji) images.
; Simple GIMP script for batch filter operations. Will retain transparency. Intended input image format is PNG.
; Made this for the purpose of adding drop shadows and other filters to Shimeji imagesets. Save this file
; to ~/.gimp scripts/ . Execute in the directory containing the images you wish to modify :
; gimp-console -b '(batch-drop-shadow "*.png" 0 0 4)' -b '(gimp-quit 0)'
; Where 0 0 4 is the x offset, y offset and the radius for the drop shadow.
; For more information on how to apply other filters, check out Filters -> Script-Fu -> Console -> Browse in GIMP
(define (batch-drop-shadow pattern
offsetx