Skip to content

Instantly share code, notes, and snippets.

View jmfernandez's full-sized avatar

José María Fernández jmfernandez

View GitHub Profile
@dsheiko
dsheiko / post-commit
Last active June 27, 2024 08:17
Git-hook to create a tag automatically based on lately committed package.json version
#! /bin/bash
version=`git diff HEAD^..HEAD -- "$(git rev-parse --show-toplevel)"/package.json | grep -m 1 '^\+.*version' | sed -s 's/[^A-Z0-9\.\-]//g'`
if [[ ! $version =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)(\-[A-Z]+\.[0-9]+)?$ ]]; then
echo -e "Skip tag: invalid version '$version'"
exit 1
fi
git tag -a "v$version" -m "`git log -1 --format=%s`"
echo "Created a new tag, v$version"
@kgriffs
kgriffs / string_util.lua
Created May 27, 2020 17:41
Lua string utilities (contains, startswith, endswith, replace, insert)
function string:contains(sub)
return self:find(sub, 1, true) ~= nil
end
function string:startswith(start)
return self:sub(1, #start) == start
end
function string:endswith(ending)
@thomas479
thomas479 / pull.sh
Last active December 29, 2024 19:03
Android adb pull all files as tar
adb exec-out 'tar --dereference --create --exclude=sdcard/Android/data/com.spotify.music/ \
sdcard/ 2>/sdcard/backup-errors.txt' | \
dd of=backup-$(date +%Y%m%d).tar && \
adb shell cat /sdcard/backup-errors.txt
@AnatomicJC
AnatomicJC / android-backup-apk-and-datas.md
Last active May 2, 2025 21:46
Backup android app, data included, no root needed, with adb

Backup android app, data included, no root needed, with adb

Note: This gist may be outdated, thanks to all contributors in comments.

adb is the Android CLI tool with which you can interact with your android device, from your PC

You must enable developer mode (tap 7 times on the build version in parameters) and install adb on your PC.

Don't hesitate to read comments, there is useful tips, thanks guys for this !

@ipan
ipan / diff-jq.md
Created January 16, 2018 04:47
compare two JSONs with jq #json #jq
@Tblue
Tblue / mozlz4a.py
Last active April 19, 2025 08:52
MozLz4a compression/decompression utility
#!/usr/bin/env python3
# vim: sw=4 ts=4 et tw=100 cc=+1
#
####################################################################################################
# DESCRIPTION #
####################################################################################################
#
# Decompressor/compressor for files in Mozilla's "mozLz4" format. Firefox uses this file format to
# compress e. g. bookmark backups (*.jsonlz4).
#
@oguya
oguya / install-go.md
Created May 20, 2015 03:39
install go to a custom location
  • download & install go in your home dir

      mkdir ~/src
      wget "https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz"
      tar -xvf go1.4.2.linux-amd64.tar.gz
      export GOROOT="$HOME/src/go"
      export PATH="$PATH:$GOROOT/bin"
    
  • create a directory where go would download & install packages using go get