Skip to content

Instantly share code, notes, and snippets.

Working from home

Eged Zsolt sontqq

Working from home
View GitHub Profile
private String getDeviceClass(BluetoothDevice bluetoothDevice) {
int devclass = bluetoothDevice.getBluetoothClass().getDeviceClass();
if (devclass == BluetoothClass.Device.Major.COMPUTER) {
return "PC";
} else if (devclass == BluetoothClass.Device.Major.PHONE) {
return "PHONE";
} else if (devclass == BluetoothClass.Device.Major.AUDIO_VIDEO) {
return "AUDIO_VIDEO";
} else if (devclass == BluetoothClass.Device.Major.HEALTH) {
return "HEALTH";
sontqq /
Created Jun 14, 2020
Bash script for checking linux service status and sends mail if its down
declare -a SERVICES=(
for i in "${SERVICES[@]}"; do
systemctl is-active --quiet "$i" && STATUS="active" || STATUS="notactive"
if [ "${STATUS}" = "active" ]; then
View Android Java Initialize Overlay
public static void initHeadOverlay(Context c) {
try {
if (headoverlay_mHeadView != null) {
headoverlay_mHeadView = null;
headoverlay_mHeadView = LayoutInflater.from(c).inflate(R.layout.head_layout, null);
final WindowManager.LayoutParams params = new WindowManager.LayoutParams(
sontqq /
Created Dec 24, 2019
Direct Connect++ $Lock to $Key conversion class (Java)
class DCConvert {
private String retKey;
private int len;
private static boolean DEBUG = false;
public DCConvert(String s) {
char[] lock = s.toCharArray();
len = lock.length;
char[] key = new char[len];
for (int i = 0; i < s.length(); i++) {
sontqq / howto.txt
Created Dec 15, 2019
Android Java - How to run repetitive tasks
View howto.txt
new Timer().scheduleAtFixedRate(new TimerTask() {
public void run() {
}, 0, 10000);
android.os.Handler handler = new android.os.Handler();
handler.postDelayed(new Runnable(){
public void run(){
sontqq / comparison.txt
Created Dec 15, 2019
Bluetooth Classic vs Bluetooth Low Energy differencies, usages
View comparison.txt
Bluetooth LOW ENERGY
Optimized for: Short burst data transmission
Frequency Band: 2.4GHz ISM Band (2.402 – 2.480 GHz Utilized)
Channels: 40 channels with 2 MHz spacing (3 advertising channels/37 data channels)
Channel Usage: Frequency-Hopping Spread Spectrum (FHSS)
Modulation: GFSK
Power Consumption: ~0.01x to 0.5x of reference (depending on use case)
Data Rate: LE 2M PHY: 2 Mb/s LE 1M PHY: 1 Mb/s LE Coded PHY (S=2): 500 Kb/s LE Coded PHY (S=8): 125 Kb/s
Max Tx Power: Class 1: 100 mW (+20 dBm) Class 1.5: 10 mW (+10 dbm) Class 2: 2.5 mW (+4 dBm) Class 3: 1 mW (0 dBm)
sontqq / index.h
Created Dec 15, 2019
esp8266 relay code for smart plug with eveng logging to php/mysql
View index.h
const char MAIN_page[] PROGMEM = R"=====(
@media only screen and (max-device-width: 480px) {
//.zoom { zoom: 150%; position: fixed; }
font-size: 16px;
sontqq / cmd.txt
Created Oct 30, 2019
View cmd.txt
tshark -T fields -e wlan.sa_resolved -e wlan.da._resolved -e -l -i wlan0 -o gui.column.format:'"MAC", "%uhs","RSSI", "%e"' | while read line; do echo "$line" >> mac.log; done
# SZAR sudo tshark -S -l -i wlan0 -Y 'wlan.fc.type_subtype eq 4' -T fields -e -e wlan_mgt.ssid
tshark -i wlan0 -Y http.request -T fields -e -e http.request.full_uri
tshark -i wlan0 -f "src port 53" -n -T fields -e frame.time -e ip.src -e ip.dst -e
tshark -i wlan0 -Y 'http.request.method == POST and tcp contains "password"' | grep password
SELECT * FROM gps WHERE whattime > CURDATE();
sontqq /
Created Oct 30, 2019
package sample;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
public class TimeElapsedUtil {
sontqq /
Created Nov 4, 2018
Update all cloned git repos in a single directory by a single command
echo "\n\033[1mPulling in latest changes for all repositories...\033[0m\n"
for i in $(find . -name ".git" | cut -c 3-); do
echo "";
echo "\033[33m"+$i+"\033[0m";