This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
IP_VLAN=10.22.2.1 | |
if curl -s $IP_VLAN > /dev/null; then | |
echo "Access to $IP_VLAN (vlan) is open." | |
else | |
echo "Access to $IP_VLAN (vlan) is not available." | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Concerns\Audit; | |
use JetBrains\PhpStorm\ArrayShape; | |
/** | |
* @method \Illuminate\Database\Eloquent\Relations\MorphMany<OwenIt\Auditing\Contracts\Audit> audits() | |
* | |
* @method save() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create new user | |
useradd -m dentro | |
passwd dentro | |
# add user to sudo-group | |
usermod -aG sudo dentro | |
# move to new user sh | |
su dentro | |
cd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# make sure to run `update` and `upgrade` before proceeding, and if there is kernel update, please reboot before continue | |
#!/bin/bash | |
sudo apt get nala cargo | |
sudo nala install linux-firmware linux-generic ronn build-essential pkg-config | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# make sure to run `update` and `upgrade` before proceeding, and if there is kernel update, please reboot before continue | |
#!/bin/bash | |
sudo nala install linux-firmware linux-generic ronn build-essential pkg-config | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh | |
mkdir -p ~/downloads |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DB_CONNECTION=pgsql | |
DB_HOST=db | |
DB_PORT=5432 | |
DB_DATABASE=my_db | |
DB_USERNAME=my_user | |
DB_PASSWORD=my_pass@123 | |
DOCKER_PORT=8888 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// might be called from Activity.onCreate or Fragment.onViewCreated | |
override fun setupViews() { | |
// setup stub behavior on sales | |
ViewStubBehavior.setup( | |
viewBinding.flSales, | |
viewBinding.stubSales, | |
viewBinding.scrollContainer | |
) { _, view -> | |
val stubBinding = DataBindingUtil.bind<ViewSectionSalesBinding>(view) | |
stubBinding?.lifecycleOwner = this |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.view.ViewStub | |
import android.widget.FrameLayout | |
import androidx.databinding.ViewStubProxy | |
object ViewStubBehavior { | |
fun setup( | |
stubWrapper: FrameLayout, | |
stubProxy: ViewStubProxy, | |
scrollContainer: FrameLayout, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Debounce<T>( | |
val data: LiveData<T>, | |
delay: Long = 500L, | |
call: (data: T) -> Unit | |
) : CoroutineScope { | |
override val coroutineContext: CoroutineContext = Dispatchers.Main | |
private var debounce = delay // ms | |
private var job: Job? = null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object PartRequest { | |
@JvmStatic | |
fun buildFileBody(file: File): RequestBody { | |
return RequestBody.create(MediaType.parse("image/jpg"), file) | |
} | |
@JvmStatic | |
fun buildTextBody(value: String): RequestBody { | |
return RequestBody.create(MediaType.parse("text/plain"), value) |
NewerOlder