Skip to content

Instantly share code, notes, and snippets.

View av1024's full-sized avatar

Alexander Voronin av1024

  • Russia
View GitHub Profile
@av1024
av1024 / jethome-D1-pre-setup.sh
Created January 9, 2022 10:33
JetHome D1/512 начальная настройка, чтобы не забыть. Запускать от root
#!/bin/bash
# info
uname -a
# Linux jethub-j100 5.9.16-jethubj100 #trunk.5 SMP PREEMPT Wed Apr 21 13:45:03 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux
lsb_release -a
#No LSB modules are available.
#Distributor ID: Ubuntu
#Description: Ubuntu 20.04.2 LTS
#Release: 20.04
@av1024
av1024 / dav2mkv.sh
Created November 23, 2019 09:40
ffmpeg HDAV (DVR/camera) to MKV if video freezed
#!/bin/bash
# China cam/DVR .DAV to .mkv with audio container change
# use latest (git) ffmpeg with DHAV support from https://johnvansickle.com/ffmpeg/
# use if normal conversion produces freezed video on start
# place actual video format and framereate
DAVVIDEO="hevc"
DAVFR="12"
@av1024
av1024 / JLinkGDB_IMG.sh
Last active December 29, 2017 21:53
rtlDuino (RTL87xx dev) Arduino@linux upload (JLinkRAM/IMG network OTA tested)
#!/bin/bash
if [ ! -d "${1}" ]; then
# goto no_dir
JLinkGDBServer -device Cortex-M3 -if SWD -ir -endian little -speed 3500 &
arm-none-eabi-gdb -x gdb_img.jlink
killall JLinkGDBServer
exit 0
fi
@av1024
av1024 / pi-setup.sh
Last active December 5, 2018 10:07
Initial. setup for PI/Pine64
#!/bin/bash
echo "==============================="
echo "== PI Setup script =="
echo "==============================="
echo ""
if [ "`id -u`" != "0" ]; then
echo "*** ROOT REQUIRED ***"
#exit 1
@av1024
av1024 / espota-dbg.py
Last active August 29, 2015 14:25
Dry-run/Debug OTA script forESP8266 Arduino
#!/usr/bin/env python
#
# this script will push an OTA update to the ESP
# use it like: python espota.py <ESP_IP_address> <ESP_IP_port> <sketch.bin>
# updated version with CRC check by Alexander Voronin, av1024@gmail.com
# Look at mDNS_SD_OTA sample for information
"""Use following (simplified) sample code for reception simulation in OTA handler:
@av1024
av1024 / ExpLvActioMode.java
Created October 1, 2013 20:53
ExpandableListView group click selection change for Contextual ActioBar
@Override
public boolean onGroupClick(ExpandableListView alv, View view, int pos, long id) {
if (actionMode == null) return false;
int i = alv.getFlatListPosition(ExpandableListView.getPackedPositionForGroup(pos));
alv.setItemChecked(i, !alv.isItemChecked(i)); // Toggle checked state. Modify for exclusive selection
try {
if (alv.getCheckedItemPosition() != -1)
//noinspection ConstantConditions
actionMode.getMenu().findItem(R.id.frag_accounts_del).setVisible(true);
@av1024
av1024 / FragmentExpListStoreExpandede.java
Last active December 23, 2015 12:38
Store/Restore Expandable listview state in Fragment on orientation changes and app restart.
/**
* Mark selected IDs as expanded
* @param ids List of ArrayAdapter ID's to be expanded
*/
private void setExpandedIds(ArrayList<Long> ids) {
if ((ids == null) || (ids.size()==0)) return;
YAMKAccountAdapter adp = (YAMKAccountAdapter) lv.getExpandableListAdapter();
if (adp != null) {
int sz = adp.getGroupCount();
for (int i=0;i<sz;i++) {