Skip to content

Instantly share code, notes, and snippets.

execve("/usr/bin/ping", ["ping"], 0x7ffcea24eba8 /* 34 vars */) = 0
access("/etc/suid-debug", F_OK) = -1 ENOENT (No such file or directory)
brk(NULL) = 0x55fe078d1000
arch_prctl(0x3001 /* ARCH_??? */, 0x7ffcd925d700) = -1 EINVAL (Invalid argument)
fcntl(0, F_GETFD) = 0
fcntl(1, F_GETFD) = 0
fcntl(2, F_GETFD) = 0
access("/etc/suid-debug", F_OK) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
@zeroarst
zeroarst / gist:be0c538ad6ea09d69c2d200dd994e2df
Last active March 24, 2024 03:39
strace for curl command
execve("/usr/bin/curl", ["curl"], 0x7ffc508efbb8 /* 34 vars */) = 0
brk(NULL) = 0x55a92945e000
arch_prctl(0x3001 /* ARCH_??? */, 0x7fffa10ef000) = -1 EINVAL (Invalid argument)
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=48791, ...}) = 0
mmap(NULL, 48791, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fab95765000
close(3) = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libcurl.so.4", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200\t\1\0\0\0\0\0"..., 832) = 832
@zeroarst
zeroarst / setStyle.kt
Created February 17, 2022 07:48
NotificationCompat.Builder.setStyle.kt
val builder = NotificationCompat.Builder(this@PlaybackService, NOTI_CHANNEL_ID).apply {
setStyle(
androidx.media.app.NotificationCompat.MediaStyle().also {
it.setShowActionsInCompactView(1, 2, 3)
.setMediaSession(mediaSession.sessionToken)
.setShowCancelButton(true)
.setCancelButtonIntent(
MediaButtonReceiver.buildMediaButtonPendingIntent(
this@YourMusicService,
PlaybackStateCompat.ACTION_STOP
@zeroarst
zeroarst / MediaMetadataCompat.kt
Last active February 17, 2022 07:47
Notification.MediaStyle
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mediaSession.setMetadata(
MediaMetadataCompat.Builder()
.putString(MediaMetadata.METADATA_KEY_TITLE, title)
.putString(MediaMetadata.METADATA_KEY_ARTIST, PlaybackAudioInfo.artist)
.build()
)
}
@zeroarst
zeroarst / after.kt
Last active July 10, 2020 15:26
Chaining Kotlin Type Casting and following execution together!! (1)
// add this !!
infix fun <T, R> T?.then(block: T.() -> R): R? = this?.block()
abstract class Animal
class Cat : Animal() {
fun say() = "meow"
}
fun main() {
@zeroarst
zeroarst / before.kt
Last active July 10, 2020 15:26
Chaining Kotlin Type Casting and following execution together!! (1)
abstract class Animal
class Cat : Animal() {
fun say() = "meow"
}
fun main() {
val myCat: Animal = Cat()
println((myCat as? Cat)?.say())
}
@zeroarst
zeroarst / BaseCallbackFragment.java
Last active February 18, 2022 20:10
Using annotation to autmatically cast Android fragment callback. This automatically handles attach&detach fragment listeners for reducing Boilerplate code.
public abstract class BaseCallbackFragment extends Fragment {
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface FragmentCallback {
/**
* Determine if throws excpetion if target does not implement the callback.
* @return true: throws an exception if not implemented.
*/
boolean mandatory() default true;
@zeroarst
zeroarst / Readme.md
Created July 3, 2016 13:14 — forked from gabrielemariotti/Readme.md
A SimpleSectionedRecyclerViewAdapter: use this class to realize a simple sectioned `RecyclerView.Adapter`.

You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.

The RecyclerView should use a LinearLayoutManager. You can use this code also with the TwoWayView with the ListLayoutManager (https://github.com/lucasr/twoway-view)

This is a porting of the class SimpleSectionedListAdapter provided by Google

Screen

Example:

@zeroarst
zeroarst / TwitterUtils.java
Last active August 29, 2015 14:05
A handy util that help you to let the users interact with twitter authorization page by using webview embbed in dialogframent plus twitter4j
package com.zeroarst.android;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.net.Uri;
@zeroarst
zeroarst / GsonRequest.java
Created September 1, 2014 08:56 — forked from ficusk/GsonRequest.java
Added parameter where override getParams method
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkResponse;
import com.android.volley.ParseError;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.Response.ErrorListener;
import com.android.volley.Response.Listener;