Skip to content

Instantly share code, notes, and snippets.

@psu
psu / log-extract-akeneo.sh
Created March 7, 2024 14:37
Miller - Extract information and attributes from an Akeneo PIM log file
#!/bin/zsh -
############################################################################
# Miller - Extract information and attributes from an Akeneo PIM log file #
# Pontus Sundén 2024 #
############################################################################
if [[ $# == 0 || $1 == "--help" || $1 == "-h" ]]; then
echo
echo ' Miller - Extract information and attributes from an Akeneo PIM log file'
@psu
psu / csv-translate-with-mapping.sh
Last active March 7, 2024 11:49
Miller - Translate values in CSV file with mapping ("old" to "new")
#! /bin/zsh -
########################################################################
# Miller - Translate values in CSV file with mapping ("old" to "new") #
# Pontus Sundén 2024 #
########################################################################
# get input from fancy command line flags
zmodload zsh/zutil
zparseopts -A ARGUMENTS -input: -map: -column:
@psu
psu / jq-qlerify-commands.sh
Last active March 5, 2024 10:13
JQ & Qlerify commands
###############################################
# JQ & Qlerify commands -- Pontus Sundén 2024 #
###############################################
### BASICS
# List event descriptions
jq '.eventsJson[].description'
# List events with type appended (if other than "Task)
@psu
psu / miller-commands.sh
Last active March 1, 2024 15:18
MILLER commands
#########################################
# MILLER commands -- Pontus Sundén 2024 #
#########################################
# Transpose two CSV rows to a tab-separated list
mlr --c2d --ops tab --ofs newline cat
# Change each occurrence of value X
mlr --csv put '$* = apply(func(k,v){if(v=="X"){v="Y"};return {k:v}})'
@psu
psu / ffmpeg.sh
Created January 27, 2023 08:14
ffmpeg.sh
# Convert .mkv to .mp4
ffmpeg -i "${input_file}" -vcodec copy -acodec copy "${output_file_name}".mp4
@psu
psu / handle-files.sh
Last active May 5, 2023 10:51
handle-files.sh
# Change encoding for text file
iconv -f "ISO-8859-1" -t "UTF-8" "${input_file}" -s > "${output_file}"
# Remove tags and move to Archive folder
for file in {query}
do
# remove tag information in extended attributes, FinderInfo contains color info
xattr -d com.apple.metadata:_kMDItemUserTags "$file"
@psu
psu / jq-jira-commands.sh
Last active March 1, 2024 15:19
JQ & Jira commands
############################################
# JQ & Jira commands -- Pontus Sundén 2024 #
############################################
# Search Jira with jira-cmd (palashkulsh/jira-cmd) and
# re-structure the result into Alfred app Script Filter JSON
jira jql --json true "(summary ~ '$1' OR description ~ '$1') AND project IN (${projects})" | \
jq '.[] | {
uid: .key,
@psu
psu / logseq-config-default-queries.edn
Last active May 2, 2024 17:02
logseq-config-default-queries.edn
;; Logseq Default Query 6-pack
;; ---------------------------
;;
;; Pontus Sundén (@psu)
;; October 28, 2022
;;
;; Attribution
;; - https://gist.github.com/sawhney17/3a1b04936f35df80253431a61cb74737
;;
;; ---------------------------