Skip to content

Instantly share code, notes, and snippets.

View sontqq's full-sized avatar
🏠
Working from home

Eged Zsolt sontqq

🏠
Working from home
View GitHub Profile
@sontqq
sontqq / update-git.sh
Created November 4, 2018 07:45
Update all cloned git repos in a single directory by a single command
#!/bin/bash
CUR_DIR=$(pwd)
counter=0
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";
counter=$((counter+1))
@sontqq
sontqq / TimeElapsedUtil.java
Created October 30, 2019 23:10
TimeElapsedUtil.java
package sample;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
public class TimeElapsedUtil {
@sontqq
sontqq / cmd.txt
Created October 30, 2019 23:15
UsefulLinuxCommands.txt
tshark -T fields -e wlan.sa_resolved -e wlan.da._resolved -e wlan.sa -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 wlan.sa -e wlan_mgt.ssid
tshark -i wlan0 -Y http.request -T fields -e http.host -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 dns.qry.name
tshark -i wlan0 -Y 'http.request.method == POST and tcp contains "password"' | grep password
SELECT * FROM gps WHERE whattime > CURDATE();
@sontqq
sontqq / index.h
Created December 15, 2019 05:42
esp8266 relay code for smart plug with eveng logging to php/mysql
const char MAIN_page[] PROGMEM = R"=====(
<html>
<head>
<title>SONT RELAY CONTROL PAGE</title>
<style>
@media only screen and (max-device-width: 480px) {
//.zoom { zoom: 150%; position: fixed; }
}
small{
font-size: 16px;
@sontqq
sontqq / comparison.txt
Created December 15, 2019 05:48
Bluetooth Classic vs Bluetooth Low Energy differencies, usages
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
sontqq / howto.txt
Created December 15, 2019 15:15
Android Java - How to run repetitive tasks
new Timer().scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
method_call();
}
}, 0, 10000);
android.os.Handler handler = new android.os.Handler();
handler.postDelayed(new Runnable(){
public void run(){
@sontqq
sontqq / DCConvert.java
Created December 24, 2019 09:32
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++) {
public static void initHeadOverlay(Context c) {
try {
if (headoverlay_mHeadView != null) {
headoverlay_mHeadView.setVisibility(View.GONE);
headoverlay_mHeadView = null;
}
headoverlay_mHeadView = LayoutInflater.from(c).inflate(R.layout.head_layout, null);
final WindowManager.LayoutParams params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
@sontqq
sontqq / servicechecker.sh
Created June 14, 2020 05:51
Bash script for checking linux service status and sends mail if its down
declare -a SERVICES=(
nginx
mysql
testservice
)
for i in "${SERVICES[@]}"; do
systemctl is-active --quiet "$i" && STATUS="active" || STATUS="notactive"
if [ "${STATUS}" = "active" ]; then
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";