Skip to content

Instantly share code, notes, and snippets.

View 166MMX's full-sized avatar

Johannes Harth 166MMX

View GitHub Profile
@166MMX
166MMX / cmd.origin.sh
Last active January 13, 2024 17:24
macOS Sierra /usr/bin/ Origin
#!/usr/bin/env bash
main() {
header
find "$1" \( -type f -o -type l \) -print0 | while IFS= read -r -d ''; do
second "$REPLY"
done
}
second() {
apply plugin: 'java'
tasks.findByName(BasePlugin.UPLOAD_ARCHIVES_TASK_NAME).dependsOn LifecycleBasePlugin.CHECK_TASK_NAME
artifacts.add Dependency.ARCHIVES_CONFIGURATION, tasks.create('javadocJar', Jar.class, {
it.from it.project.tasks.withType(Javadoc.class)
it.group = LifecycleBasePlugin.BUILD_GROUP
it.classifier = 'javadoc'
it.description = 'Assembles a jar archive containing the Javadoc API documentation for the main source code.'
})
@166MMX
166MMX / commands.md
Last active February 16, 2017 05:23
  • list bundle identifier of installed applications mdfind -0 -onlyin /Applications "kMDItemKind == 'Application'" | xargs -0 mdls -name kMDItemCFBundleIdentifier -raw | tr $"\0" $'\n' | sed '/^(null)$/d' | sort
  • list names of installed applications mdfind -0 -onlyin /Applications "kMDItemKind == 'Application'" | xargs -0 mdls -name kMDItemDisplayName -raw | tr $"\0" $'\n' | sed '/^(null)$/d' | sort
#!/usr/bin/env groovy
import groovy.sql.GroovyResultSet
import groovy.sql.Sql
import org.apache.commons.lang3.StringEscapeUtils
import java.nio.file.Paths
import java.util.regex.Pattern
// https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc
// https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
#!/usr/bin/env bash
set -u -x
app_path="$1"
target_dev="$2"
if [ ! -d "$app_path" ]; then
printf 'No such Application at "%s"' "$app_path" >&2
exit 1
fi
if [ ! -b "$target_dev" ]; then
@166MMX
166MMX / crx_unpkg.sh
Last active December 6, 2016 13:25
Unpackages a CRX Chrome extension package and verify it's signature
#!/usr/bin/env bash
# based on https://web.archive.org/web/20160819192900/https://developer.chrome.com/extensions/crx
set -e -u
crx="$1"
crx_off=0
crx_len=$(stat -f %z "$crx")
hdr_off=$crx_off
hdr_len=16
pub_off=$((hdr_off + hdr_len))
xattr -px com.apple.metadata:_kMDItemUserTags "example.rtf" | xxd -r -p - - | plutil -convert xml1 -o - -
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXAggregateTarget section */
D41E1E0B0D8758A200F46F50 /* Plugins */ = {
@166MMX
166MMX / parse_pbzx2.py
Created October 2, 2016 21:34 — forked from Manouchehri/parse_pbzx2.py
A pbzx stream decoder for the format found within Yosemite package payloads.
# v2 pbzx stream handler
# My personal writeup on the differences here: https://gist.github.com/pudquick/29fcfe09c326a9b96cf5
#
# Pure python reimplementation of .cpio.xz content extraction from pbzx file payload originally here:
# http://www.tonymacx86.com/general-help/135458-pbzx-stream-parser.html
#
# Cleaned up C version (as the basis for my code) here, thanks to Pepijn Bruienne / @bruienne
# https://gist.github.com/bruienne/029494bbcfb358098b41
import struct, sys