Skip to content

Instantly share code, notes, and snippets.

@illarionov
illarionov / githubrepo.init.gradle
Created February 14, 2026 11:19
Adding github credentials to all projects
// 1) Generate classic token with read:packages permission
// 2) Save this to ~/.gradle/init.d
// 3) change <token> to generated token
logger.info('Applying init.gradle to add Github credentials')
def githubCredentials = {
username = 'illarionov'
password = '<token>'
}
@illarionov
illarionov / app-chicory-emscripten.kt
Created March 8, 2025 05:12
Chicory + Emscripten + own imports
/*
* Copyright 2024-2025, the wasi-emscripten-host project authors and contributors. Please see the AUTHORS file
* for details. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
* SPDX-License-Identifier: Apache-2.0
*/
@file:Suppress("CommentWrapping")
package at.released.weh.sample.chicory.gradle.app
@illarionov
illarionov / build.gradle.kts
Created May 2, 2024 19:19
Adding git version number to Kotlin source code
import java.io.ByteArrayOutputStream
abstract class GitShaValueSource : ValueSource<String, ValueSourceParameters.None> {
@get:Inject
abstract val execOperations: ExecOperations
override fun obtain(): String {
return try {
val output = ByteArrayOutputStream()
execOperations.exec {
@illarionov
illarionov / build.gradle.kts
Created April 17, 2024 13:33
Enabling JVMCI and adding Graal compiler to the upgrade-module-path in android unit tests
configurations {
dependencyScope("graalvmCompiler")
resolvable("graalvmCompilerClasspath") {
extendsFrom(configurations["graalvmCompiler"])
}
}
dependencies {
add("graalvmCompiler", "org.graalvm.compiler:compiler:24.0.1")
}
@illarionov
illarionov / MainActivity.kt
Last active January 17, 2022 12:17
Demonstration that the Android can destroy background activities on memory pressure without restarting the application
/**
* Demonstration that the Android can destroy background activities on memory pressure without restarting
* the application
https://cs.android.com/android/platform/superproject/+/android-12.0.0_r4:frameworks/base/core/java/android/app/ActivityThread.java;l=7534
*/
const val ARG_ACTIVITY_NO = "ARG_ACTIVITY_NO"
const val TAG = "MainActivity"
val gcThresholds = GcActivityMemoryThresholds()
@illarionov
illarionov / dlink_ports.pl
Created February 7, 2017 09:20
ports set converter for D-link switches
@illarionov
illarionov / uicolor2argb
Created August 15, 2016 13:06
UIColor(red:0.643, green:0.549, blue:0.839, alpha: 1) -> ffa48cd6
#!/bin/sh
#Usage: echo 'UIColor(red:0.643, green:0.549, blue:0.839, alpha: 1)' | uicolor2argb
perl -nle 'if (/UIColor\(red\:\s*(\S+)\,\s*green:\s*(\S+)\,\s*blue:\s*(\S+),\s*alpha:\s*(\S)/) { printf "%02x%02x%02x%02x\n", 0.5+255*$4, 0.5 + 255 * $1, 0.5+255*$2, 0.5+255*$3}'
package com.example.swiperefreshtest;
import android.content.Context;
import android.support.v4.widget.SwipeRefreshLayout;
import android.util.AttributeSet;
import android.view.View;
import android.widget.AbsListView;
public class MySwipeRefreshLayout extends SwipeRefreshLayout
@illarionov
illarionov / build.sh
Created August 13, 2013 14:14
Compile sqlcipher 2.21 with libspatialite-4.1.1
#!/bin/sh
#sqlcipher
git clone https://github.com/sqlcipher/sqlcipher.git
cd sqlcipher
./configure --enable-tempstore=yes --enable-load-extension CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto"
sudo make install
cd ..
#spatialite
@illarionov
illarionov / sync_shapers.pl
Created January 19, 2013 22:54
Cкрипт, синхронизирующий состояние IPFW с текстовым конфигом с шейперами sync_shapers.pl. Описание: http://forum.nag.ru/forum/index.php?showtopic=54379&view=findpost&p=518655
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
use Class::Struct;
use Data::Dumper;
use Fcntl qw(:flock);
use Getopt::Long;
use Pod::Usage;