Skip to content

Instantly share code, notes, and snippets.

View ezralazuardy's full-sized avatar
😶
I may be slow to respond.

Ezra Lazuardy ezralazuardy

😶
I may be slow to respond.
View GitHub Profile
# https://support.atlassian.com/bitbucket-cloud/docs/configure-bitbucket-pipelinesyml
# Maintainer: Ezra Lazuardy <ezra@exclolab.com>
definitions:
steps:
- step: &build-project
name: Build Project
image: ezralazuardy/ravel:8.2
services:
- mysql
script:
@ezralazuardy
ezralazuardy / user_as_an_owner.sh
Created November 4, 2021 17:29
🔐 Set up Laravel Application File Permissions
# based on https://stackoverflow.com/a/37266353/8109202
# licensed with https://creativecommons.org/licenses/by-sa/4.0
# assuming this is your laravel project directory
cd /var/www/laravel
sudo chown -R $USER:www-data .
# if any node_modules exists, remove it
sudo rm -rf node_modules
@ezralazuardy
ezralazuardy / headers.conf
Last active March 6, 2021 23:17
🛡️ Apache2 Recommended Web Security Headers
<Directory "/">
# ----------------------------------------------------------------------
# | Security Headers |
# ----------------------------------------------------------------------
<IfModule mod_headers.c>
# ----------------------------------------------------------------------
# | HTTP Strict Transport Security (HSTS) |
# ----------------------------------------------------------------------
Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
data class Country(val name: String, val case: Int, val recovered: Int, val death: Int)
val countries = listOf(
Country("Indonesia", 7418, 913, 635),
Country("United States", 827038, 75528, 45525),
Country("South Korea", 10694, 8277, 238),
Country("Switzerland", 27926, 19400, 1491),
Country("China", 82788, 77151, 4632),
Country("Germany", 148704, 87055, 5100),
Country("Spain", 208389, 85915, 21717)
data class Person(val name: String, val age: Int)
val data = listOf(
Person("Ezra Lazuardy", 18),
Person("__##CORRUPTED#Albert Einstein", 0),
Person("__##CORRUPTED#Mark Zuckerberg", 0),
Person("Fadzrian", 20),
Person("Kurniawan Vendy", 21),
Person("__##CORRUPTED#Dea Kamila", 0),
Person("Krishna Mahira", 10),
val data = arrayOf(10, 2, 2, 6, 8, 90, 23, 15, 11, 4, 2, 6, 7, 8, 1, 3, 16, 8, 2, 1, 10)
fun main() {
println("Mean: ${mean(data)}")
println("Median: ${median(data)}")
println("Modus: ${modus(data)}")
}
private fun mean(data: Array<Int>): String =
"%.2f".format(data.average())
#!/bin/bash
if ![$(id -u)=0]; then
echo "Please run this script as root" >&2
exit 1
fi
echo -1 > /sys/module/usbcore/parameters/autosuspend
echo "Webcam bug has been fixed"
package com.quick.jti.satpam.utils
import com.google.gson.GsonBuilder
import com.quick.jti.satpam.config.AppConfig
import com.quick.jti.satpam.config.AppConfig.IO_TIMEOUT
import com.quick.jti.satpam.model.destination.*
import com.quick.jti.satpam.model.items.*
import okhttp3.OkHttpClient
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
/*
* Created by Ezra Lazuardy on 05/02/20, 10:26 AM
* Copyright (c) 2020 . All rights reserved.
* Last modified 05/02/20, 10:26 PM
*/
package com.quick.jti.satpam.utils
import com.google.gson.*
import java.lang.reflect.Type
{
"CLASSNAME": "OutItems",
"DATA": {
}
}