Skip to content

Instantly share code, notes, and snippets.

@lamoboos223
lamoboos223 / esp8266_output_to_arduino_uno.md
Last active April 1, 2024 03:17
connect esp8266 to output a value to arduino uno where arduino reads this value and do some action

Arduino code

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);   // Initialize the serial communication

  pinMode(7, INPUT);

}
from flask import Flask, request
from graphene import ObjectType, String, Schema, List, Field
'''
Pre-requesities: python3 -m pip install graphene flask
USAGE: open Postman and create new QraphQL request then paste this url: http://localhost:5000/graphql and these Queries ...
pip install jaeger-client
from jaeger_client import Tracer, SpanContext, Config

# Replace these with your actual configuration
SERVICE_NAME = "your-application-name"
COLLECTOR_HOST = "localhost"
import pika
import json

# Connect to RabbitMQ
connection = pika.BlockingConnection(
    pika.ConnectionParameters('localhost', 5672)
)
channel = connection.channel()
docker pull docker.elastic.co/elasticsearch/elasticsearch:7.17.15
docker pull docker.elastic.co/kibana/kibana:7.17.15
docker run -d --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.17.15
docker run -d --name kibana --link elasticsearch:elasticsearch -p 5601:5601 docker.elastic.co/kibana/kibana:7.17.15

question: i have centos7 vm and when i write lama i want the terminal to cd to /etc and mkdir there called test then ls in the /etc directory. i can do that using an alias but i don't want to create this alias each time i'm on a centos7 machine, instead i want to yum install the command lama so it does that for me, how to create it as package where i can yum install it on other centos7 machines?

solution: To create a package that can be installed using yum on CentOS 7 machines, you can create a RPM package. Here's a step-by-step guide on how to create an RPM package for your lama command:

sudo raspi-config
sudo reboot
lsmod | grep spi
sudo apt-get update -y && sudo apt-get upgrade -y && sudo apt-get install -y python3-dev python3-pip && sudo pip install spidev mfrc522 && mkdir ~/pi-rfid && cd ~/pi-rfid
printf "
import RPi.GPIO as GPIO
from mfrc522 import SimpleMFRC522
reader = SimpleMFRC522()

print kernels for each video device

udevadm info --attribute-walk --name=/dev/video5 | grep "KERNELS"
sudo nano /etc/udev/rules.d/99-custom-camera.rules

add the following rules

@lamoboos223
lamoboos223 / rpicam-gstreamer.txt
Created June 27, 2023 10:44 — forked from muellermartin/rpicam-gstreamer.txt
Stream video from Raspberry Pi with camera attached to CSI port via RTP (UDP) using GStreamer
Useful Links:
- http://stackoverflow.com/questions/25941171/how-to-get-gstreamer1-0-working-with-v4l2-raspicam-driver
- http://raspberrypi.stackexchange.com/questions/26675/modern-way-to-stream-h-264-from-the-raspberry-cam
- http://stackoverflow.com/questions/13154983/gstreamer-rtp-stream-to-vlc
- http://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/gst/rtp/README
- http://archpi.dabase.com/#sending-and-receiving-pi-camera-video-over-the-network
- http://emmanuelgranatello.blogspot.de/2013/10/raspberry-pi-gstreamer-streaming-h264.html
- http://stackoverflow.com/questions/15712983/why-rtp-streaming-of-a-avi-video-file-fails-to-be-received
@lamoboos223
lamoboos223 / pi_picture.sh
Last active June 28, 2023 12:31
taking pictures and videos using pi camera module
# take one picture and save it into file
raspistill -o test.jpg
# record a video for 10 seconds in the h264 codec
raspivid -o test.h264 -t 10000
# GStreamer
gst-launch-1.0 -e -v v4l2src device=/dev/video0 ! video/x-raw,format=YUY2,width=640,height=480,framerate=10/1 ! videoconvert ! x264enc tune=zerolatency ! rtph264pay config-interval=1 pt=96 ! udpsink host=192.168.3.6 port=5006 sync=false
gst-launch-1.0 -v v4l2src device=/dev/video0 ! 'video/x-raw,width=640,height=480' ! x264enc tune=zerolatency ! 'video/x-h264,stream-format=byte-stream' ! h264parse ! rtph264pay ! udpsink host=192.168.3.6 port=5006
# the below is the one that worked