Skip to content

Instantly share code, notes, and snippets.

View jyurek's full-sized avatar

Jon Yurek jyurek

View GitHub Profile
@jyurek
jyurek / tm.sh
Last active February 12, 2024 10:37
Create and switch sessions in tmux quickly
#!/bin/sh
tm() {
if [ -z $1 ]; then
tmux switch-client -l
else
if [ -z "$TMUX" ]; then
tmux new-session -As $1
else
if ! tmux has-session -t $1 2>/dev/null; then
TMUX= tmux new-session -ds $1
@jyurek
jyurek / palette
Last active October 2, 2015 19:32
A small bash script for outputting the most used 5 colors in an image.
#!/bin/bash
for c in $(convert $1 -colors 5 -depth 8 -format %c histogram:info: | sort -d -r | cut -d '#' -f 2 | cut -d ' ' -f 1); do
colors+=($c)
convert -size 50x50 'canvas:#'$c /tmp/$c.png
done
color_files=
for c in ${colors[@]}; do
color_files="$color_files /tmp/$c.png"