Skip to content

Instantly share code, notes, and snippets.

View dalerazimov's full-sized avatar

Daler Azimov dalerazimov

View GitHub Profile
@dalerazimov
dalerazimov / command.sh
Last active November 9, 2026 06:03
Vips install with RAW support (conda-forge, macOS 11+)
#!/bin/bash
# Installs libvips with camera RAW support (.fff, .3fr, ...) for Convertessa,
# from conda-forge prebuilt packages. Works on macOS 11 or later.
# No password, no Homebrew, nothing to compile. Installs into ~/.convertessa/vips
# and links vips into ~/.local/bin, where Convertessa looks for it.
set -euo pipefail
case "$(uname -m)" in arm64) PLATFORM=osx-arm64 ;; *) PLATFORM=osx-64 ;; esac
DEST="$HOME/.convertessa/vips"
TMP="$(mktemp -d)"
@dalerazimov
dalerazimov / command.sh
Last active November 2, 2026 04:24
Vips install
sudo -v && { [ -x /opt/homebrew/bin/brew ] || [ -x /usr/local/bin/brew ] || NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"; } && eval "$(/opt/homebrew/bin/brew shellenv 2>/dev/null || /usr/local/bin/brew shellenv)" && HOMEBREW_NO_ASK=1 brew install vips && V=$( { [ -x /opt/homebrew/bin/vips ] && echo /opt/homebrew/bin/vips; } || { [ -x /usr/local/bin/vips ] && echo /usr/local/bin/vips; } ) && "$V" black "$TMPDIR/vips-test.png" 8 8 && rm "$TMPDIR/vips-test.png" && echo "Done, $("$V" --version) is installed and working"
@dalerazimov
dalerazimov / binary_search.php
Created November 25, 2024 15:04
Binary search
/**
* @param Integer[] $nums
* @param Integer $target
* @return Integer
*/
function search(array $nums, int $target): int {
$left = 0;
$right = count($nums) - 1;
while ($left <= $right) {
@dalerazimov
dalerazimov / Converter.php
Created October 13, 2021 05:34
Array to object mapper
<?php
declare(strict_types=1);
class Converter
{
/**
* @param array $array
* @param $object
* @return object
* @throws \RuntimeException
@dalerazimov
dalerazimov / gist:fd57fc57a22f1653e7c67e40bbc6a63b
Created February 10, 2021 04:39
Regex to match ipv4 addresses, range and mask
^([01]?\d\d?|2[0-4]\d|25[0-5])(?:\.(?:[01]?\d\d?|2[0-4]\d|25[0-5])){3}(?:\/[0-2]\d|\/3[0-2])?(?:\-([01]?\d\d?|2[0-4]\d|25[0-5]))?$
# true
255.255.255.255/30
255.255.255.0
255.255.255.100-200
# false
255.255.255.255/33
255.255.255.256
@dalerazimov
dalerazimov / Usage.class
Created January 27, 2021 12:31
Dynamically create links in textview, android
#
# Credits: https://stackoverflow.com/a/45727769/2679982
#
TextView textView = view.findViewById(R.id.textview);
textView.setText("Dynamically created link");
List<Pair<String, View.OnClickListener>> links = new ArrayList<>();
links.add(new Pair<>(getString(R.string.auth_passport_confirm_agreement_link_label), new View.OnClickListener() {
@Override
@dalerazimov
dalerazimov / proguard-rules.pro
Created September 15, 2020 06:27
Android build with minify null pointer exception fix
-keepclassmembers,allowobfuscation class * {
@com.google.gson.annotations.SerializedName <fields>;
}
-keep,allowobfuscation @interface com.google.gson.annotations.SerializedName
@dalerazimov
dalerazimov / gist:fa5bb00b925aa231b34cf37c6b83042d
Created September 15, 2020 03:20
SSL Pinning hash generator from domain name
openssl s_client -servername example.com -connect example.com:443 | openssl x509 -pubkey -noout | openssl rsa -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64
@dalerazimov
dalerazimov / main.java
Created June 2, 2020 08:26
AES/ECB/PKCS5Padding Example
import javax.crypto.*;
import javax.crypto.spec.*;
import java.util.*;
public class main {
public static void main(String[] args) throws Exception {
String keyRaw = "fLVjUa1Sw2Auca6R9VSvLmI0T4OnmgvV";
SecretKeySpec skeySpec = new SecretKeySpec(keyRaw.getBytes(), "AES");
@dalerazimov
dalerazimov / regex.txt
Last active April 6, 2020 07:53
Префиксы и регулярные выражения номеров мобильных операторов Республики Таджикистан
Все номера РТ:
\+{0,1}(992)?(\d{9}$)
Мегафон Таджикистан
(\+)?(992)?((90|88|55|00)\d{7})$
90* ** ****
88* ** ****
55* ** ****
00* ** ****