Skip to content

Instantly share code, notes, and snippets.

Avatar

Antonio López Marín tonilopezmr

View GitHub Profile
@tonilopezmr
tonilopezmr / pre-commit-ktlint
Last active May 18, 2018
Pre-commit hook to run ktlint with auto-correct option and it adds the auto-correct changes into the commit.
View pre-commit-ktlint
#!/bin/sh
# https://github.com/shyiko/ktlint pre-commit hook
git diff --name-only --cached --relative | grep '\.kt[s"]\?$' | xargs ktlint -F --relative .
if [ $? -ne 0 ]; then exit 1; else git add .; fi
View sender.kt
class Sender {
fun send(send: Send, message: String, to: String) {
send.send(to, message)
}
}
interface Send {
fun send(to: String, message: String)
@tonilopezmr
tonilopezmr / build.gradle
Created Sep 25, 2016
Create auto VersionName and VersionCode
View build.gradle
def computeVersionName() {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--abbrev=0', '--tags'
standardOutput = stdout
}
return stdout.toString().trim().replaceAll('v', '')
}
def computeVersionCode() {
View gifconverter
#!/bin/sh
palette="/tmp/palette.png"
filters="fps=15,scale=540:-1:flags=lanczos"
ffmpeg -v warning -i $1 -vf "$filters,palettegen" -y $palette
ffmpeg -v warning -i $1 -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $2
You can’t perform that action at this time.