Skip to content

Instantly share code, notes, and snippets.

View indramahkota's full-sized avatar
:electron:
Learning

Indra Mahkota indramahkota

:electron:
Learning
View GitHub Profile
@indramahkota
indramahkota / git_submodules.md
Created August 6, 2022 04:58 — forked from gitaarik/git_submodules.md
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of advantages of using submodules:

  • You can separate the code into different repositories.

EDIT from 2019: Hi folks. I wrote this gist for myself and some friends, and it seems like it's gotten posted somewhere that's generated some (ahem, heated) discussion. The whitespace was correct when it was posted, and since then GitHub changed how it formats <pre> tags. Look at the raw text if you care about this. I'm sure someone could tell me how to fix it, but (thank you @anzdaddy for suggesting a formatting workaround) honestly this is a random throwaway gist from 2015, and someone more knowledgable about this comparison should just write a proper blog post about it. If you comment here I'll hopefully see it and stick a link to it up here. Cheers. @oconnor663

Here's the canonical TOML example from the TOML README, and a YAML version of the same.

title = "TOML Example"
 
@indramahkota
indramahkota / AESEncryptDecrypt.kt
Created January 31, 2022 07:45 — forked from reuniware/AESEncryptDecrypt.kt
(Android/Kotlin) Encrypt and Decrypt with AES algorithm, and save/restore Secret Key and Inizialization Vector in SharedPreferences
fun encrypt(context:Context, strToEncrypt: String): ByteArray {
val plainText = strToEncrypt.toByteArray(Charsets.UTF_8)
val keygen = KeyGenerator.getInstance("AES")
keygen.init(256)
val key = keygen.generateKey()
saveSecretKey(context, key)
val cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING")
cipher.init(Cipher.ENCRYPT_MODE, key)
val cipherText = cipher.doFinal(plainText)
@indramahkota
indramahkota / sha_aes_utility.kt
Created January 31, 2022 07:45 — forked from reuniware/sha_aes_utility.kt
Android Kotlin : SHA-1 Hash and AES Encryption/Decryption and Storing password, secretKey, IV and Hash in Shared Preferences
fun hashAndSavePasswordHash(context: Context, clearPassword: String) {
val digest = MessageDigest.getInstance("SHA-1")
val result = digest.digest(clearPassword.toByteArray(Charsets.UTF_8))
val sb = StringBuilder()
for (b in result) {
sb.append(String.format("%02X", b))
}
val hashedPassword = sb.toString()
val sharedPref = PreferenceManager.getDefaultSharedPreferences(context)
val editor = sharedPref.edit()
@indramahkota
indramahkota / gist:caca309ad7297af7a26a9edffcea6a1e
Created December 20, 2021 14:02 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.details.fragment.NextMatchesFragment">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".ui.details.DetailsActivity">
#include <iostream>
using namespace std;
int main()
{
int a, b, c, d;
cout << "Masukkan nilai A: ";
cin >> a;
import android.view.View;
public class CustomOnItemClickListener implements View.OnClickListener {
private final int position;
private final OnItemClickCallback onItemClickCallback;
public CustomOnItemClickListener(int position, OnItemClickCallback onItemClickCallback) {
this.position = position;
this.onItemClickCallback = onItemClickCallback;
}
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/layout_details"
android:paddingBottom="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout