Skip to content

Instantly share code, notes, and snippets.

View triandamai's full-sized avatar
🏠
Working from home

trian damai triandamai

🏠
Working from home
View GitHub Profile
@triandamai
triandamai / aes-cbc-padding.kts
Created July 6, 2023 11:18 — forked from flymrc/aes-cbc-padding.kts
Kotlin AES Encryption and Decryption
// ref: https://www.baeldung.com/java-aes-encryption-decryption
import java.util.*
import javax.crypto.Cipher
import javax.crypto.spec.IvParameterSpec
import javax.crypto.spec.SecretKeySpec
fun decrypt(algorithm: String, cipherText: String, key: SecretKeySpec, iv: IvParameterSpec): String {
val cipher = Cipher.getInstance(algorithm)
package des.c5inco.cardswipecompose
import androidx.compose.animation.core.*
import androidx.compose.animation.splineBasedDecay
import androidx.compose.foundation.background
import androidx.compose.foundation.gestures.awaitFirstDown
import androidx.compose.foundation.gestures.verticalDrag
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
to check if the server works - https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice
stun:
stun.l.google.com:19302,
stun1.l.google.com:19302,
stun2.l.google.com:19302,
stun3.l.google.com:19302,
stun4.l.google.com:19302,
stun.ekiga.net,
stun.ideasip.com,
@triandamai
triandamai / settings.json
Created June 5, 2022 07:49 — forked from danielroe/extensions.json
VScode settings for a minimal UI
{
// Disable telemetry
"telemetry.telemetryLevel": "off",
// Zen mode
"zenMode.fullScreen": false,
"zenMode.hideTabs": true,
"zenMode.centerLayout": false,
// Theming
"workbench.iconTheme": "city-lights-icons-vsc",
"editor.fontFamily": "Dank Mono",
@triandamai
triandamai / memory.md
Created January 28, 2022 13:45 — forked from a-r-d/memory.md
A million ways to change HEAP memory in Java

Xmx vs Xms

Remember, Xmx corresponds to max heap and Xms corresponds to starting heap. It can be an optimization to set these equal.

In Spring Boot build.gradle

bootRun {
      jvmArgs = ['-Xmx1g']
}
@triandamai
triandamai / api.js
Created April 24, 2021 16:40 — forked from lorenzofox3/api.js
separation-of-concern
import {createService} from './movies-service.js';
export default async (instance) => {
const {Movie} = instance; // mongoose model injected
instance.register(async (instance) => {
// we overwrite for the scope by our service instead
instance.decorate('Movie', createService({model: Movie}));
instance.register(routesPlugin);
});
}
@triandamai
triandamai / SingleAdapter.java
Last active April 7, 2021 13:32
SingleAdapter
public class SingleAdapter<T> extends RecyclerView.Adapter<SingleAdapter.ViewHolder> {
private static String TAG = SingleAdapter.class.getSimpleName() + " -> ";
/**
* dataset for recyler item
*
* @see ArrayList
* @see List
*/
private List<T> mDataset = new ArrayList<>();