Skip to content

Instantly share code, notes, and snippets.

View harryhan24's full-sized avatar

harry han harryhan24

View GitHub Profile
@dekalo-stanislav
dekalo-stanislav / versioning.gradle
Created March 21, 2017 10:21
Semantic Versioning for android application
/**
* Will generate versionCode from versionName that follows Semantic Versioning
*/
ext {
/**
* Application version is located version variable.
* And should follow next policy:
* X1.X2.X3-type-flavor, where X - any digits and type is optional alphabetical suffix.
* X1 - major version
* X2 - minor version
@DavidWells
DavidWells / serverless.yml
Created September 15, 2017 05:39
DynamoDB custom index serverless.yml example
service: service-name
provider:
name: aws
runtime: nodejs6.10
functions:
myfunc:
handler: handler.myfunc
@chrisdiana
chrisdiana / export-cognito-users.sh
Last active March 18, 2024 09:38
Export AWS Cognito User Pool
# Export as Text Table
aws --region XXXXXXXXX cognito-idp list-users --user-pool-id XXXXXXXXXXXXX --output table > ~/users.txt
# Export as JSON
aws --region XXXXXXXXX cognito-idp list-users --user-pool-id XXXXXXXXXXXXX --output json > ~/users.json
# Export User Pool with more than 60 users (pagination)
aws --region XXXXXXXXX cognito-idp list-users --user-pool-id XXXXXXXXXXXXX --pagination-token INCREDIBLYLONGSTRINGHERE --output json > ~/users-2.json
@DavidWells
DavidWells / serverless.yml
Created December 24, 2017 20:56 — forked from jscattergood/serverless.yml
Creating a custom serverless resource for subscribing to SNS topics in another region
# Welcome to Serverless!
#
# Happy Coding!
service: cross-region-sns-subscriber
# Keep environment specific configurations in separate files
custom: ${file(config/${env:STAGE}.json)}
provider:
@mjuric
mjuric / DockerUserNamespacesOnCentOS74.md
Last active September 6, 2023 18:31
Setting up Docker with user namespaces on CentOS 7.4

Setting up Docker with user namespaces on CentOS 7.4

The procedure below has been tested on a Digital Ocean VM with CentOS 7.4

# Install docker from RHEL’s standard repos
yum install -y docker

#
# We’ll activate the ‘user namespaces’ feature that defends against
@albertogiunta
albertogiunta / Extensions.kt
Created March 20, 2018 10:30
Extension functions (Kotlin) & build.gradle files for Android projects
/**
* ANY
*/
fun Any.toJson(): String = GsonInitializer.toJson(this)
/**
* VIEW
*/
fun View.toggleVisibility(setAsVisible: Boolean) = if (setAsVisible) this.visible() else this.gone()
@iChintanSoni
iChintanSoni / ApiService.kt
Last active January 23, 2020 00:34
Daggering kotlin-android: AppModule.kt
interface ApiService {
@GET("api")
fun getUsers(@Query("result") result: Int): Observable<RandomUserResponse>
}
@lub0s
lub0s / ordinal.kt
Created April 17, 2018 16:22
ordinal of sealed class subclass
sealed class Event {
object One : Event()
object Two : Event()
data class Three(val int: Int) : Event()
}
inline fun <reified T : Any> T.ordinal() =
T::class.java.superclass.classes.indexOfFirst { sub -> sub == this@ordinal::class.java }
fun testOrdinal() {
@dabit3
dabit3 / index.js
Last active December 29, 2021 06:38
Lambda function to interact with Amazon Polly & Amazon Translate
var AWS = require('aws-sdk')
AWS.config.update({region: 'us-east-1'})
const uuidV4 = require('uuid/v4')
var translate = new AWS.Translate();
var polly = new AWS.Polly();
var s3 = new AWS.S3({
params: {
Bucket: 'YOURBUCKETNAME',
}
})
@ArthurNagy
ArthurNagy / RoundedBottomSheetDialogFragment.kt
Last active March 10, 2025 08:53
Rounded modal bottom sheet as seen in new Google products(Tasks, News, etc.), described in this article: https://medium.com/halcyon-mobile/implementing-googles-refreshed-modal-bottom-sheet-4e76cb5de65b
package com.your.package
import android.app.Dialog
import android.os.Bundle
import com.your.package.R
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
/**
* BottomSheetDialog fragment that uses a custom