Skip to content

Instantly share code, notes, and snippets.

@NoxWings
NoxWings / printPIXIHierarchy.js
Last active August 27, 2020 13:20
Print PIXI tree hierarchy
function printHierarchy(node, padding="") {
let newPadding = padding;
if (node.name) {
newPadding += " |";
console.log(`${padding}-${node.name}`);
}
node.children.forEach(child => printHierarchy(child, newPadding));
}
@eckelon
eckelon / batchImageOptim.sh
Last active October 30, 2017 16:24
I wrote this script to compress a very heavy project images folder. It works with jpg and png. It worked for me, but it may need some modifications to solve your problem
#!/bin/bash
#this script was written to be called with find, something like:
# find . -type f \( -name *.jpg -o -name *.png -o -name *.JPG -o -name *.PNG \) -exec ~/batchImageOptim.sh "{}" \;
if [[ $# == 1 ]]; then
input_file="$1"
else
echo "no arguments, no party"
exit 255
@staltz
staltz / introrx.md
Last active September 25, 2024 09:04
The introduction to Reactive Programming you've been missing
@jehrhardt
jehrhardt / KeyLengthDetector.java
Created March 15, 2013 06:23
Detect the allowed size of AES keys on the JVM. If the size is <= 256, it is limited. To fix it JCE unlimted stregth files are needed.
import javax.crypto.Cipher;
import java.security.NoSuchAlgorithmException;
public class KeyLengthDetector {
public static void main(String[] args) {
int allowedKeyLength = 0;
try {
allowedKeyLength = Cipher.getMaxAllowedKeyLength("AES");
} catch (NoSuchAlgorithmException e) {
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@gfrison
gfrison / groovy-date-time-operations
Created February 5, 2011 15:00
How to add months, days, years to a date in Groovy
Groovy also has a Time Category class which gives you DSL style syntax for manipulating dates. Here is an example:
import org.codehaus.groovy.runtime.TimeCategory
now = new Date()
println now
use(TimeCategory) {
footballPractice = now + 1.week - 4.days + 2.hours - 3.seconds
}
println footballPractice
which will produce output like this: