Skip to content

Instantly share code, notes, and snippets.

View Khazbs's full-sized avatar
🐺
.let { it.be() }

Arthur Khazbulatov Khazbs

🐺
.let { it.be() }
  • TelePat, LLC
  • Moscow, Russia
  • 09:15 (UTC +03:00)
View GitHub Profile
@Khazbs
Khazbs / .zshrc
Created March 26, 2025 12:43
AKA for ZSH
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.zsh_aliases, instead of adding them here directly.
if [ -f ~/.zsh_aliases ]; then
. ~/.zsh_aliases
fi
# Write new alias to ~/.zsh_aliases and source that file.
@Khazbs
Khazbs / .env
Last active December 6, 2024 23:33
If Outline shadowsocks server doesn't work for you, try this Docker Compose deployment of shadowsocks-libev! For a full list of environment variables, click "latest" here: https://hub.docker.com/r/shadowsocks/shadowsocks-libev/tags — and look for lines starting with ENV
PASSWORD=YourHopefullyVeryStrongAndSecretPassword
METHOD=aes-256-gcm
@Khazbs
Khazbs / MainActivity.kt
Created October 14, 2024 14:54
Filled Icon Button Colors With Alpha
package ru.shindei.testapp
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.consumeWindowInsets
import androidx.compose.foundation.layout.fillMaxSize
@Khazbs
Khazbs / MainActivity.kt
Created July 21, 2024 20:19
How to wed Scaffold, LazyColumn and IME padding in Jetpack Compose edge-to-edge
package com.example.app
import android.os.Bundle
import androidx.activity.*
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.runtime.saveable.rememberSaveable
Verifying that I control the following Nostr public key: npub1qwu0f8cyudfhdl0enwfurxnhe6t5086s94t2dnr88t8rq63a7y8qfaysfd
import androidx.compose.animation.animateContentSize
import androidx.compose.foundation.*
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Favorite
import androidx.compose.material.icons.outlined.FavoriteBorder
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.runtime.saveable.rememberSaveable
@Khazbs
Khazbs / edge-to-edge.md
Last active November 26, 2024 00:57
If enableEdgeToEdge sucks for your Android activity's Compose UI, try this instead!

Go Edge-to-Edge on Android in a More Customizable Way

Google currently recommends calling enableEdgeToEdge() in order to make your Compose UI go edge-to-edge. However, the result it yields may be slightly different from how you really want your app's activity to look. For example, an unwanted semi-transparent scrim may appear behind the navigation bar. Don't worry, it's actually possible to tweak most of this stuff!

Here I show the three steps I take to go edge-to-edge. You can try it yourself and see if you like it too! If you have any questions, suggestions for improvement or your own preferred solutions, feel free to leave a comment down below, I'm open and curious to read them!

@Khazbs
Khazbs / .bashrc
Last active September 29, 2022 11:34
Add this to your .bashrc to get a handy bak function for backing up files and directories
# Create backup copies of files or directories
bak() {
local name="$1.bak"
if [ -e "$name" ]; then
local -i num=2
while [ -e "$name$num" ]; do
num+=1
done
cp -rv "$1" "$name$num"
@Khazbs
Khazbs / Theme.kt
Last active March 8, 2025 16:14
This snippet might help you make a Material Design 3 theme for your Jetpack Compose app
package my.awesome.package // put your package name here
import android.app.Activity
import android.os.Build
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.SideEffect
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.LocalContext
@Khazbs
Khazbs / nabla.py
Created March 12, 2021 14:12
Calculate function gradient via numpy
import numpy as np
def nabla(f):
n = f.__code__.co_argcount
d = (np.arange(-100, 101, 1) for i in range(n))
x = np.meshgrid(*d)
return np.gradient(f(*x))