Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Nathan Mkaya nathanmkaya

🎯
Focusing
View GitHub Profile
@msramalho
msramalho / Cryptography.java
Created Jan 13, 2020
Java Class to manage cryptography keys in Android Keystore using "AES/CBC/PKCS7Padding" - encrypt and decrypt strings
View Cryptography.java
import android.security.keystore.KeyGenParameterSpec;
import android.security.keystore.KeyProperties;
import android.util.Base64;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.KeyStore;
import java.security.KeyStoreException;
@akaita
akaita / encryptedsharedpreferences-12.kt
Last active Jan 28, 2020
encryptedsharedpreferences-12.kt
View encryptedsharedpreferences-12.kt
// Step 1: Create or retrieve the Master Key for encryption/decryption
val masterKeyAlias = MasterKeys.getOrCreate(MasterKeys.AES256_GCM_SPEC)
// Step 2: Initialize/open an instance of EncryptedSharedPreferences
val sharedPreferences = EncryptedSharedPreferences.create(
"PreferencesFilename",
masterKeyAlias,
applicationContext,
EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM
@umidjons
umidjons / youtube-dl-download-audio-only-on-best-quality.md
Last active Sep 19, 2020
Download Audio from YouTube with youtube-dl
View youtube-dl-download-audio-only-on-best-quality.md

Download Audio from YouTube

-i - ignore errors

-c - continue

-t - use video title as file name

--extract-audio - extract audio track

@Trucido
Trucido / openSUSE-Leap-42.3-pam_kwallet-guide.md
Last active Aug 18, 2020 — forked from benediktg/pam_kwallet-guide.md
How to configure pam_kwallet to auto-unlock kdewallet from sddm login credentials on openSUSE Leap 42.3 KDE Plasma5
View openSUSE-Leap-42.3-pam_kwallet-guide.md

How to configure pam_kwallet to auto-unlock the default kwallet5 "kdewallet" from sddm login credentials on openSUSE Leap 42.3 KDE Plasma5

Note: Many other guides & posts were attempted before creating this, however they either no longer work or are ugly hacks which don't follow SUSE's odd pam.d layouts. Essentially, this solution boils down to this: pam_kwallet needs to be loaded from it's own substack just like pam_gnome_keyring already is configured to do so, so new substacks were created based on the gnome_keyring ones so that they could be added to sddm. I'm unsure how both gnome_keyring and kwallet behave if both are loaded from the same substack so I kept them in separate stacks. This was tested with only kwallet5 installed but it should also optionally load the old kwallet4 if it's present. My understanding of PAM is limited, so I'm open to suggestions, but this seemed like the cleanest solution which doesn't get overwritten on updates, though it should probably be globally registered as a

@redleafar
redleafar / add_footer_navigation_drawer.md
Created Feb 25, 2017
Add footer to NavigationDrawer
View add_footer_navigation_drawer.md
@bobbytables
bobbytables / build.sh
Created Feb 18, 2017
Protocol Buffer build script for multiple folders
View build.sh
#!/usr/bin/env bash
# This script is meant to build and compile every protocolbuffer for each
# service declared in this repository (as defined by sub-directories).
# It compiles using docker containers based on Namely's protoc image
# seen here: https://github.com/namely/docker-protoc
set -e
REPOPATH=${REPOPATH-/opt/protolangs}
CURRENT_BRANCH=${CIRCLE_BRANCH-"branch-not-available"}
@JosiasSena
JosiasSena / DeCryptor.java
Last active Sep 18, 2020
Encryptor and Decryptor for data encryption.decryption using the Android KeyStore.
View DeCryptor.java
/**
_____ _____ _
| __ \ / ____| | |
| | | | ___| | _ __ _ _ _ __ | |_ ___ _ __
| | | |/ _ \ | | '__| | | | '_ \| __/ _ \| '__|
| |__| | __/ |____| | | |_| | |_) | || (_) | |
|_____/ \___|\_____|_| \__, | .__/ \__\___/|_|
__/ | |
|___/|_|
*/
@posener
posener / go-kit.md
Last active Sep 10, 2020
Why I Recommend to Avoid Using the go-kit Library
View go-kit.md

Why I Recommend to Avoid Using the go-kit Library

There is a trending 'microservice' library called go-kit. I've been using the go-kit library for a while now. The library provide a lot of convenience integrations that you might need in your service: with service discovery with Consul, distributed tracing with Zipkin, for example, and nice logic utilities such as round robin client side load balancing, and circuit breaking. It is also providing a way to implement communication layer, with support of RPC and REST.

@benediktg
benediktg / pam_kwallet-guide.md
Last active May 3, 2020
Short guide for pam_kwallet with KDE Plasma 5 on openSUSE
View pam_kwallet-guide.md

(based on these two blog entries and inspired by Fedora-Blog)

First install pam_kwallet:

sudo zypper in pam_kwallet

Then edit the files /etc/pam.d/passwd, /etc/pam.d/login and /etc/pam.d/sddm as follows, i.e. add the lines beginning with a - (the hyphens are valid PAM syntax to reduce log entries if these PAM modules should not exist) and ending with the ### comment:

/etc/pam.d/passwd :

@jaredsburrows
jaredsburrows / RxBus1.java
Last active May 20, 2019
RxBus for RxJava 1 and RxJava 2
View RxBus1.java
import rx.Observable;
import rx.subjects.PublishSubject;
import rx.subjects.SerializedSubject;
import rx.subjects.Subject;
/**
* @author <a href="mailto:jaredsburrows@gmail.com">Jared Burrows</a>
*/
public final class RxBus {
private final Subject<Object, Object> bus = new SerializedSubject<>(PublishSubject.create());
You can’t perform that action at this time.