This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Add this to .bash_profile or .profile | |
export CLICOLOR=1 | |
export LSCOLORS=GxFxCxDxBxegedabagaced | |
export PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#Usage: ./gifenc.sh video.mkv anim.gif | |
palette="/tmp/palette.png" | |
filters="fps=30,scale=320:-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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
intent.putExtra(Intent.EXTRA_REFERRER, | |
Uri.parse("android-app://" + context.getPackageName())); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// sw-offline-google-analytics *must* be imported and initialized before | |
// sw-toolbox, because its 'fetch' event handler needs to run first. | |
importScripts('/sw-offline-google-analytics/offline-google-analytics-import.js'); | |
goog.offlineGoogleAnalytics.initialize(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// GA embed code | |
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | |
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), | |
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) | |
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); | |
ga('create', 'Your GA ID', 'auto'); | |
// The following line sets the dimension to the pageview request. | |
ga('set', 'Your Dimension Name', navigator.onLine); | |
ga('send', 'pageview'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Setup a listener to track Add to Homescreen events. | |
window.addEventListener('beforeinstallprompt', e => { | |
e.userChoice.then(choiceResult => { | |
ga('send', 'event', 'A2H', choiceResult.outcome); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "PWA Directory", | |
"short_name": "PWA Directory", | |
"description": "A Directory of PWAs", | |
"//": "Append tracking parameters to start_url", | |
"start_url": "/?utm_source=homescreen", | |
"..." | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -X POST -H "Authorization: key=<Firebase Auth Key>" -H "Content-Type: application/json" -d '{}' "https://iid.googleapis.com/iid/v1/<User-FCM-Token>/rel/topics/my-topic" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -X POST -H "Authorization: key=<Firebase-Auth-Key>" -H "Content-Type: application/json" -d '{ | |
"to": "/topics/test", | |
"registration_tokens": ["User-FCM-Token"] | |
}' "https://iid.googleapis.com/iid/v1:batchRemove" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -X POST -H "Authorization: key=<Firebase Auth Key>" -H "Content-Type: application/json" -d '{ | |
"notification": { | |
"title": "A Notification to My Topic", | |
"body": "Add more information to your notification here!", | |
"icon": "https://www.example.com/my-notification-icon.png", | |
"click_action": "https://www.example.com/url-to-open-from-notification.html" | |
}, | |
"to": "/topics/my-topic" | |
}' "https://fcm.googleapis.com/fcm/send" |