Skip to content

Instantly share code, notes, and snippets.

View jimmyFlash's full-sized avatar
:atom:

Jamal jimmyFlash

:atom:
View GitHub Profile
class LogInModelTest : LogInListener {
private lateinit var successTask: Task<AuthResult>
private lateinit var failureTask: Task<AuthResult>
@Mock
private lateinit val mAuth: FirebaseAuth
private lateinit var logInModel: LogInModel
private var logInResult = UNDEF
@dinorahto
dinorahto / KeyPairGenerator.kt
Last active July 26, 2020 04:33
KeyPairGenerator.kt
KeyPairGenerator.getInstance(KeyProperties.KEY_ALGORITHM_RSA, "AndroidKeyStore").apply {
val certBuilder = KeyGenParameterSpec.Builder(alias, KeyProperties.PURPOSE_ENCRYPT)
.setKeyValidityStart(keyValidityStart)
.setKeyValidityEnd(keyValidityEnd)
.setCertificateSerialNumber(BigInteger.valueOf(1L))
.setCertificateSubject(X500Principal("CN=MyCompany"))
.setUserAuthenticationRequired(true)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
initialize(
certBuilder
@catalinsgh
catalinsgh / PasswordValidatorTest.kt
Created June 29, 2020 19:48
PasswordValidatorTest using ParameterizedTest
internal class PasswordValidatorTest {
private val validator = PasswordValidator()
@ParameterizedTest(name = "given \"{0}\", when validating the password, then it should return {1}")
@MethodSource("passwordArguments")
fun `given input password, when validating it, then is should return if it is valid`(
password: String,
expected: Boolean
) {
@catalinsgh
catalinsgh / PasswordValidatorTest.kt
Created June 30, 2020 18:40
PasswordValidatorTest using dynamic tests
internal class PasswordValidatorTest {
private val validator = PasswordValidator()
@TestFactory
fun `given input password, when validating it, then is should return if it is valid`() =
listOf(
"Test123!" to true,
"#tesT12!" to true,
"12Es@t123" to true,
@AhmedMourad0
AhmedMourad0 / value-based-adt-list-with-nocopy-example.kt
Created September 5, 2020 01:05
Code snippets for the `value-based classes and error-handling` Medium article.
@NoCopy
data class Password private constructor(val value: String) {
companion object {
fun of(value: String): Either<List<Violation>, Password> {
val violations = buildList {
if (value.isTooShort()) { add(Violation.PasswordTooShort(MIN_LENGTH)) }
if (value.containsNoNumbers()) { add(Violation.PasswordContainsNoNumbers) }
}
return if (violations.isEmpty()) Password(value).right() else violations.left()
}
name: DangerJS
on: [pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
@damian-burke
damian-burke / dangerfile.js
Created September 13, 2020 21:09
Dangerfile to scan ktlint / detekt / Android Lint reports
import {danger, fail, message, warn, schedule} from 'danger'
const reporter = require("danger-plugin-lint-report")
// Scan ktlint reports
schedule(reporter.scan({
fileMask: "**/reports/ktlint/*.xml",
reportSeverity: true,
requireLineModification: true,
}))
@riggaroo
riggaroo / create_release_branch.yml
Last active October 31, 2024 21:45
Github Action workflow for creating release branch, updating versionName and versionCode, copying strings.xml to another repo, submitting PRs as per GitFlow.
name: Create Release Branch
on:
workflow_dispatch:
inputs:
versionName:
description: 'Name of version (ie 5.5.0)'
required: true
versionCode:
description: 'Version number (50500)'
required: true
@adavis
adavis / ChipsView.kt
Last active March 26, 2024 02:00
A function to programmatically add views to ConstraintLayout with Flow
class ChipsView<T : Parcelable>(ctx: Context, attr: AttributeSet) : ConstraintLayout(ctx, attr) {
...
private fun addSubviews() {
val flow = Flow(context).apply {
id = generateViewId()
setWrapMode(Flow.WRAP_CHAIN)
setHorizontalStyle(Flow.CHAIN_PACKED)
setHorizontalAlign(Flow.HORIZONTAL_ALIGN_START)
setHorizontalBias(0f)
@teixeira0xfffff
teixeira0xfffff / ransomwarefeed.csv
Last active August 18, 2024 12:54
Ransomware Feeds
Ransomware Name URL Status
AVADDON http://avaddongun7rngel.onion/ Online
SODINOKIBI (REVIL) http://dnpscnbaix6nkwvystl3yxglz7nteicqrou3t75tpcc5532cztc46qyd.onion/ Online
NEFILIM http://hxt254aygrsziejn.onion/ Online
VFOKX (1) http://vfokxcdzjbpehgit223vzdzwte47l3zcqtafj34qrr26htjo4uf3obid.onion/ Online
VFOKX (2) http://746pbrxl7acvrlhzshosye3b3udk4plurpxt2pp27pojfhkkaooqiiqd.onion/ Online
MARKETO (deep) https://marketo.cloud/ Online
MARKETO (dark) http://g5sbltooh2okkcb2.onion/ Online
LORENZ http://lorenzmlwpzgxq736jzseuterytjueszsvznuibanxomlpkyxk6ksoyd.onion/ Online
CONTI/RYUK http://continewsnv5otx5kaoje7krkto2qbu3gtqef22mnr7eaxw3y6ncz3ad.onion/ Online