Skip to content

Instantly share code, notes, and snippets.


Timur milovtim

  • MTVv
  • Saint-Petersburg
View GitHub Profile
milovtim /
Last active Sep 29, 2020
Remove key bindings that conflicts with (shadows) intelliJ keymaps
#!/usr/bin/env bash
XCONF_PROP="xfconf-query -c xfce4-keyboard-shortcuts -p"
while IFS= read -r line; do
eval "$XCONF_PROP" "\"$line\"" "$RST";
done <<'EOF'
milovtim / get_prop_keys.bash
Last active Jan 30, 2019
Grap keys from bunch of .properties files with keys with [a-z _ .]
View get_prop_keys.bash
#!/usr/bin/env bash
# files with prop keys on each line
# Extract keys to file
awk -F = '/^[a-z_.]+=/ { print $1 }' /some/path/files > "$KEYS_FILE"
# path to some repo
milovtim /
Created Jan 10, 2019
A commands under ssh-copy-id helper script
printf '%s\n' "$NEW_IDS" | ssh "$@" "
umask 077 ;
mkdir -p .ssh && cat >> .ssh/authorized_keys || exit 1 ;
if type restorecon >/dev/null 2>&1 ; then restorecon -F .ssh .ssh/authorized_keys ; fi"
milovtim / create_logback_appenders.groovy
Last active Dec 7, 2018
LOG_PATH -- env/local var of log files location, FILE_LOG_PATTERN -- env/local val with pattern
View create_logback_appenders.groovy
def tmpl = {
<appender name="${it.toUpperCase()}_FILE"
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>\${LOG_PATH}/old/${it.toLowerCase()}_%d{yyyy-MM-dd, aux}/${it.toLowerCase()}.%d{yyyy-MM-dd-HH}.gz</fileNamePattern>

curl often used options

  • -X {method} where method is {GET,POST,HEAD,etc.} (Default: GET)
  • -v verbose mode
  • -o to_file/-O save output to_file or use server-provided filename
    • -J use filename from header
  • -L follow Location header when 3xx code returns
  • -#/--progress-bar use simple progress bar (single-line) instead of default download info
  • -s silent mode
View completable_futures_allOf_example.groovy
import groovy.transform.Canonical
import java.util.concurrent.CompletableFuture
import java.util.function.Function
import java.util.function.Supplier
final long serviceExecutionTime = 1000
def rand = new Random()
def initVal = rand.nextInt(100)
View completable-futures.groovy
import java.util.concurrent.CompletableFuture
import java.util.concurrent.TimeUnit
import java.util.function.Supplier
Supplier treeItemSupp = { sleep(50); '`treeItem`' }
Supplier eventItemSupp = { sleep(100); ' `event`'; new RuntimeException('bam!') }
Supplier l10nItemSupp(String treeItem) { return {sleep(200); " `l10n($treeItem)`"} as Supplier }
.thenCompose({ str ->
milovtim / pom.xml
Last active Apr 8, 2019
[retired, prefer gmavenplus] maven-compiler-plugin-groovy-compilation
View pom.xml
milovtim / table.filter.lua
Created Mar 16, 2018 — forked from FGRibreau/table.filter.lua
Lua table.filter (JavaScript Array::filter equivalent)
View table.filter.lua
-- table.filter({"a", "b", "c", "d"}, function(o, k, i) return o >= "c" end) --> {"c","d"}
-- @FGRibreau - Francois-Guillaume Ribreau
-- @Redsmin - A full-feature client for Redis
table.filter = function(t, filterIter)
local out = {}
for k, v in pairs(t) do
if filterIter(v, k, t) then out[k] = v end
milovtim / SpringContextHierarchy.groovy
Last active Jan 15, 2018
Demonstration on bean definitions inheritanse between parent-child contexts
View SpringContextHierarchy.groovy
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
interface ServiceInParent {
String invokeParent()
class ChildService {
ServiceInParent serviceInParent