Skip to content

Instantly share code, notes, and snippets.

View beta21s's full-sized avatar

Trần Phan An Trường beta21s

View GitHub Profile
@beta21s
beta21s / Cloud-init.yaml
Last active July 25, 2025 15:11
Cloud-init
# Cloud-init (Ubuntu)
chpasswd:
list: |
ubuntu:123456
root:123456
expire: False
ssh_pwauth: True
# Cloudbase-init (Windows)
<powershell>
```
package com.truongtpa
package Study2b
import org.apache.spark.rdd.RDD
import org.apache.spark.sql.SparkSession
object Scenario4 {
def main(args: Array[String]): Unit = {
@beta21s
beta21s / ApacheIgniteSystemdService.md
Created January 24, 2023 08:14 — forked from olaf-2/ApacheIgniteSystemdService.md
Install Apache Ignite as a systemd service

Install Apache Ignite as a systemd service

Create a user for running Apache Ignite.

sudo useradd -s /usr/sbin/nologin -m ignite

Create a folder for the configuration files and the data folder for Apache Ignite Native Persistence.

sudo -u ignite mkdir -p /home/ignite/apache-ignite-config /home/ignite/apache-ignite-data

#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
EthernetClient client;
String data;
void setup() {
Serial.begin(9600);
while (!Serial) {
Route::post('/send-email', function (Request $request) {
$json = $request->input('data');
if (ToolsModel::isJson($json)) {
$data = (array)json_decode($request->input('data'));
Mail::send($data['template'], $data, function ($m) use ($data) {
$m->from(env('MAIL_FROM_ADDRESS', null), env('MAIL_FROM_NAME', null));
$m->to($data['email'])->subject($data['subject']);
});
return ToolsModel::status(200, "Thực hiện gửi email thành công");
}
int mang[10][7] = {
{1, 1, 1, 1, 1, 1, 0}, //0
{0, 1, 1, 0, 0, 0, 0}, //1
{1, 1, 0, 1, 1, 0, 1}, //2
{1, 1, 1, 1, 0, 0, 1}, //3
{0, 1, 1, 0, 0, 1, 1}, //4
{1, 0, 1, 1, 0, 1, 1}, //5
{1, 0, 1, 1, 1, 1, 1}, //6
{1, 1, 1, 0, 0, 0, 0}, //7
{1, 1, 1, 1, 1, 1, 1}, //8
#define MOTORA_IN1 10
#define MOTORA_IN2 11
#define MOTORB_IN1 12
#define MOTORB_IN2 13
#define BUTTONA_TRAI 2
#define BUTTONA_PHAI 3
#define BUTTONB_TRAI 6
#define BUTTONB_PHAI 7
void setup() {
Serial.begin(9600);
Serial.println("Xin chao.....");
pinMode(13, OUTPUT);
pinMode(3, INPUT);
}
int st_nut = LOW; // Trạng thái trước đó của nút
long time_A = 0; // TG nhấn nút A
void loop() {
int st = digitalRead(3);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/paho-mqtt/1.0.1/mqttws31.min.js" type="text/javascript"></script>
<script src="https://code.jquery.com/jquery-3.6.1.min.js" type="text/javascript"></script>
</head>
<body>
@beta21s
beta21s / Kết nối ESP32 với MQTT Borker
Last active October 18, 2022 00:58
Đoạn code kết nối MQTT trên ESP32 điều khiển bật/tắt LED
#include <WiFi.h>
#include "PubSubClient.h"
const char * MQTTServer = "";
const char * MQTT_Topic = "";
// Tạo ID ngẫu nhiên tại: https://www.guidgen.com/
const char * MQTT_ID = "";
int Port = 1883;