Skip to content

Instantly share code, notes, and snippets.

View yaud's full-sized avatar

Yauheni Audzeichyk yaud

View GitHub Profile
@yaud
yaud / git-move-dir.md
Created December 6, 2022 23:00
git tips

Let's say there is repo-source that has sub-directory z under x/y which we want to move to repo-target:

  • go to source repo - cd repo-source
  • extract files from z into a new branch z-only - git subtree split -P x/y/z -b z-only

Now if we checkout to z-only branch all files from x/y/z will be in the root directory.

In order to preserve original directory structure move directories/files into x/y/z manually:

  • re-create x/y/z directory - mkdir -P x/y/z (mkdir x\y\z on Windows)
@yaud
yaud / adb.md
Last active April 7, 2019 05:21
Android

Download APK from a device

  • List all 3rd party packages (remove -3 to list all):
    adb shell pm list packages -f -3

  • This will print packeges in this format:
    package:/data/app/com.google.android.street-VR18cSamsCmd1GzNTB8V6A==/base.apk=com.google.android.street

  • Download APK:
    adb pull /data/app/com.google.android.street-VR18cSamsCmd1GzNTB8V6A==/base.apk

@yaud
yaud / kafka-1.1-cheatsheet.md
Last active June 15, 2018 10:54
Kafka 1.1 cheat sheet

Get latest offsets for topic:

bin/kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list localhost:9092 --topic <topic-name> --time -1

Get consumer group info:

bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --group <group-name> --describe

List topic's config overriden properties:

bin/kafka-configs.sh --zookeeper localhost:2181 --entity-type topics --entity-name <topic-name> --describe

Override topic's config property:

@yaud
yaud / flushall-cluster.sh
Created November 14, 2016 09:21
Flushall on Redis cluster
#!/bin/sh
NODES=`redis-cli -h $1 cluster nodes | cut -f2 -d' '`
IFS="
"
for node in $NODES; do
echo Flushing node $node...
redis-cli -h ${node%:*} -p ${node##*:} flushall