This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ESP32 as Bluetooth Keyboard | |
With its built-in Bluetooth capabilities, the ESP32 can act as a Bluetooth keyboard. The below code is a minimal example of how to achieve it. It will generate the key strokes for a message whenever a button attached to the ESP32 is pressed. | |
For the example setup, a momentary button should be connected to pin 2 and to ground. Pin 2 will be configured as an input with pull-up. | |
In order to receive the message, add the ESP32 as a Bluetooth keyboard of your computer or mobile phone: | |
1. Go to your computers/phones settings | |
2. Ensure Bluetooth is turned on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Node MCU pinmap | |
D0- GPIO16 | |
D1- GPIO5 | |
D2- GPIO4 | |
D3- GPIO0 | |
D4- GPIO2 | |
D5- GPIO14 | |
D6- GPIO12 | |
D7- GPIO13 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from time import sleep | |
from pynput.mouse import Listener,Button, Controller | |
mouse = Controller() | |
def on_move(x, y): | |
global p1 | |
p1=mouse.position | |
return False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.pi4j.system.SystemInfo | |
import java.io.BufferedReader | |
import java.io.IOException | |
import java.io.InputStreamReader | |
import java.net.InetAddress | |
import java.net.ServerSocket | |
import java.net.Socket | |
import java.text.ParseException |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* i2c_port_address_scanner | |
* Scans ports D0 to D7 on an ESP8266 and searches for I2C device. based on the original code | |
* available on Arduino.cc and later improved by user Krodal and Nick Gammon (www.gammon.com.au/forum/?id=10896) | |
* D8 throws exceptions thus it has been left out | |
* | |
*/ | |
#include <Wire.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class player(): | |
def __init__(self): | |
self.is_initiated = False | |
self.SEEK_TIME = 20 | |
self.MAX_VOL = 512 | |
self.MIN_VOL = 0 | |
self.DEFAULT_VOL = 256 | |
self.VOL_STEP = 13 | |
self.current_vol = self.DEFAULT_VOL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -ne 1 ] | |
then | |
echo "Invalid arguments" | |
exit | |
fi | |
re='^[0-9]+$' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyaudio | |
import socket | |
from threading import Thread | |
frames = [] | |
def udpStream(): | |
udp = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
while True: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
POSITIONAL=() | |
while [[ $# -gt 0 ]] | |
do | |
key="$1" | |
case $key in | |
-t|--time) | |
TIME="$2" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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) | |
OlderNewer