Skip to content

Instantly share code, notes, and snippets.

@GluTbl
GluTbl / droidVNC.sh
Last active June 6, 2021 03:55
[DroidVNC] #shell #linux
#!/bin/bash
echo "Connecting to the adb of the droid"
adb connect 192.168.29.246 &&
echo "Giving Accessibility Permision...."
adb shell "su -c 'settings put secure enabled_accessibility_services net.dinglisch.android.taskerm/net.dinglisch.android.taskerm.MyAccessibilityService:com.joaomgcd.autoinput/com.joaomgcd.autoinput.service.ServiceAccessibility:de.abr.android.avnc/de.abr.android.scclib.etc.AcService'" &&
sleep 5
echo "Launching app...."
adb shell am start -n de.abr.android.avnc/de.abr.android.avnc.activity.VncActivity &&
@GluTbl
GluTbl / ultrasonic_distance_measure.ino
Created April 26, 2021 05:31
[Ultrasonic distance measurre without delay by using interupts]
#include <Arduino.h>
#include <Ticker.h>
#define ULTRASONIC_PIN_INPUT D1
#define ULTRASONIC_PIN_OUTPUT D4
@GluTbl
GluTbl / logger_util.py
Last active March 29, 2021 19:47
[Python logger] get logging in python #python
import logging
# Copied from https://stackoverflow.com/a/56944256
class LogFormat(logging.Formatter):
BLUE = {"color": "blue"}
GREEN = {"color": "green"}
GREY = {"color": "grey"}
YELLOW = {"color": "yellow"}
RED = {"color": "red"}
@GluTbl
GluTbl / sample.js
Last active March 25, 2021 15:39
[Text formating at Js]
//Source https://stackoverflow.com/questions/7975005/format-a-javascript-string-using-placeholders-and-an-object-of-substitutions
const stringWithPlaceholders = 'My Name is {name} and my age is {age}.';
const replacements = {
name: 'Mike',
age: '',
};
@GluTbl
GluTbl / ReadMe.md
Created March 2, 2021 05:06
[Esptool]
@GluTbl
GluTbl / sample.sh
Last active March 29, 2021 08:02
[sudo running in as user mode] #linux
#!/bin/bash
#Detect the name of the display in use
display=":$(ls /tmp/.X11-unix/* | sed 's#/tmp/.X11-unix/X##' | head -n 1)"
#Detect the user using such display
user=$(who | grep '('$display')' | awk '{print $1}' | head -n 1)
#Detect the id of the user
uid=$(id -u $user)
@GluTbl
GluTbl / PdfSplitter.py
Last active February 3, 2021 15:03
Pdf Duplex printing split file
#!/usr/bin/python3
import argparse
import os
import sys
from pathlib import Path
from PyPDF2 import PdfFileWriter, PdfFileReader
@GluTbl
GluTbl / mynotify.sh
Last active March 29, 2021 08:03
[notify in linux from sudo or anything ] #linux #shell
#!/bin/bash
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-t|--time)
TIME="$2"
@GluTbl
GluTbl / client.py
Last active June 13, 2023 16:41
[UDP audio streaming] #python
import pyaudio
import socket
from threading import Thread
frames = []
def udpStream():
udp = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
while True:
@GluTbl
GluTbl / updater.sh
Last active March 29, 2021 08:00
[apt update and upgrade] #linux
#!/bin/bash
if [ $# -ne 1 ]
then
echo "Invalid arguments"
exit
fi
re='^[0-9]+$'