Skip to content

Instantly share code, notes, and snippets.

View rishadbaniya's full-sized avatar
:shipit:
Busy hacking myself

Rishad Baniya rishadbaniya

:shipit:
Busy hacking myself
View GitHub Profile
@Zoha131
Zoha131 / Jetpack Compose Nested Navigation
Created November 19, 2020 17:22
When I make the nested navigation the startDestination then it works otherwise I can’t go to the nested navigation. How can I navigate to the nested navigation?
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.foundation.layout.*
import androidx.compose.material.Text
import androidx.compose.material.Button
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.setContent
import androidx.compose.ui.unit.dp
@miglen
miglen / linux-networking-tools.md
Last active November 5, 2024 12:34
Linux networking tools

List of Linux networking tools

netstat (ss)

Displays contents of /proc/net files. It works with the Linux Network Subsystem, it will tell you what the status of ports are ie. open, closed, waiting, masquerade connections. It will also display various other things. It has many different options. Netstat (Network Statistic) command display connection info, routing table information etc. To displays routing table information use option as -r.

Sample output:

Proto Recv-Q Send-Q  Local Address          Foreign Address        (state)    
tcp4 0 0 127.0.0.1.62132 127.0.0.1.http ESTABLISHED
@aidanhs
aidanhs / gist:5ac9088ca0f6bdd4a370
Last active September 25, 2024 11:17
Rust binary tree worked example

PLEASE DON'T USE THIS GUIDE

It's over 9 years old (as of 2024-02-18), there are many better guides! You might like https://rust-unofficial.github.io/too-many-lists/

% Let's build a binary tree!

Let's build a binary tree of strings in Rust. To recap, each node in a binary tree:

  1. must have a value
@laaptu
laaptu / DpToPxAndPxToDp
Last active February 14, 2022 21:06
Android convert dp to px and vice versa
public static float convertPixelsToDp(float px){
DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics();
float dp = px / (metrics.densityDpi / 160f);
return Math.round(dp);
}
public static float convertDpToPixel(float dp){
DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics();
float px = dp * (metrics.densityDpi / 160f);
return Math.round(px);
@ahume
ahume / WorkerPool.js
Created December 20, 2011 11:09
Example of creating a pool of Web Workers
function WorkerPool(url) {
this.url = url;
this.pool = [];
}
WorkerPool.prototype.getWorker = function() {
var w;
if (this.pool.length > 0) {
w = this.pool.pop();
} else {
w = new Worker(this.url);