gist.tolpp
Little fluffy code snippets
Monday, June 22, 2020
List all regular files in Unix system with a global read permission.
List all regular files in Unix system with a global read permission.
Thursday, July 18, 2019
Android tathering
Behave like normal connection on tathered network on Android:
Related hackernews post: https://news.ycombinator.com/item?id=20461879
adb shell settings put global tether_dun_required 0
Related hackernews post: https://news.ycombinator.com/item?id=20461879
Friday, March 8, 2019
What to look for in code review
From the "Code Review Best Practices" post from Trisha Gee
What to look for section from slide:
- Fit with the overall architecture
- SOLID principles, Domain Driven Design, Design Patterns or other paradigms of choice
- New code follows team’s current practices
- Code is in the right place
- Code reuse
- Over-engineering
- Readable code and tests
- Testing the right things
- Exception error messages
- Subtle bugs
- Security
- Regulatory requirements
- Performance
- Documentation and/or help files been updated
- Spelling, punctuation & grammar on user messages
Wednesday, September 26, 2018
How to send Android push notification locally using ADB without need network connection
Requirements:
-
Device should be a rooted (simulator’s are rooted by default)
-
adbd should be started as root. (Rub command:
adb root
)
Now, send local push message using command:
adb shell am broadcast \
-n com.your.app/com.google.firebase.iid.FirebaseInstanceIdReceiver \
-a "com.google.android.c2dm.intent.RECEIVE" \
--es "extra1" "65" \
--es "guid" "1f400184-9215-479c-b19a-a9cd9a1d9dc9" \
--es "extra3" "VALUE" \
--es "extra4" "'Long string with spaces'"
What’s happening?
-
Simply, using adb we are broadcasting message with parameters.
-
adb shell am broadcast
command that broadcasts.
-
-n
parameter for definecomponent
(see IntentSpec@ADB Documentation)
-
We are broadcasting for
com.google.firebase.iid.FirebaseInstanceIdReceiver
, because we are using Firebase Messaging Service
-
We are sending action
-a com.google.android.c2dm.intent.RECEIVE
because FirebaseInstanceIdReceiver defines this inAndroidManifest.xml
file.
-
Also, this is why we need to be root. This action requires Signature level permission.
-
Also, this is why we need to be root. This action requires Signature level permission.
-
We are adding extras with
--es
parameter.
Now, we can get data in
Related gist page:
https://gist.github.com/tolpp/45801406e13ed7c88fb768352bb39f9b
onMessageReceived
under the FirebaseMessagingService
. When user taps notification remoteMessage.getData().get("extra1")
should be return "65"
.Related gist page:
https://gist.github.com/tolpp/45801406e13ed7c88fb768352bb39f9b
Friday, April 14, 2017
Mac remove specific user from startup screen
sudo dscl . create /Users/USERNAME IsHidden 1
Mac Allow Specific user to access for ssh
sudo dseditgroup -o edit -a USERNAME -t user com.apple.access_ssh
Monday, June 20, 2016
aws CodeCommit The requested URL returned error: 403 with Apple-Git
If you faced with this problem, probably you are using codecommit over https with apple-git.
This problem occurs because of Apple-Git caches credentials inside to the keychain. AWS CLI generates new password everytime via secret and timestamp, so it changes everytime based on time.
To achive problem, you can use nicc777's script https://github.com/nicc777/macaws-codecommit-pwdel for remove cache in time interval or you can follow instructions below:
a). Go to Keychain Access, search for codecommit (or your repository name).
b). Right click on the row and select Get Info.
c). Click on Access Control and Remove git-credentials-osxkeychain from the list and save. This way Apple-Git will not try to read from the keychain.
(source : https://forums.aws.amazon.com/thread.jspa?messageID=647431#jive-message-651375)
Other solutions:
- Use another git (ex: brew install git)
- Connect codecommit through SSH
This problem occurs because of Apple-Git caches credentials inside to the keychain. AWS CLI generates new password everytime via secret and timestamp, so it changes everytime based on time.
To achive problem, you can use nicc777's script https://github.com/nicc777/macaws-codecommit-pwdel for remove cache in time interval or you can follow instructions below:
a). Go to Keychain Access, search for codecommit (or your repository name).
b). Right click on the row and select Get Info.
c). Click on Access Control and Remove git-credentials-osxkeychain from the list and save. This way Apple-Git will not try to read from the keychain.
(source : https://forums.aws.amazon.com/thread.jspa?messageID=647431#jive-message-651375)
Other solutions:
- Use another git (ex: brew install git)
- Connect codecommit through SSH
Subscribe to:
Posts (Atom)