Skip to content

Instantly share code, notes, and snippets.

View Damarcreative's full-sized avatar
🧑‍🎓
Study

Damar Jati Damarcreative

🧑‍🎓
Study
View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>🧮 Calculator</title>
<style>
:root {
--primary: #ff6b6b;
--secondary: #4ecdc4;
@Damarcreative
Damarcreative / README.md
Last active October 1, 2024 13:16
Water_System_ESP

Dokumentasi Sistem Kontrol Relay Air IoT

1. Fitur Manual On/Off Relay

  • Terdapat toggle switch untuk menghidupkan atau mematikan relay secara manual kapan saja, terlepas dari jadwal atau pengaturan mode yang telah diset sebelumnya.
  • Jika checkbox diaktifkan (checked), relay akan ON dan jika checkbox dimatikan (unchecked), relay akan OFF.
  • Saat toggle switch diaktifkan, relay akan bekerja sesuai durasi air yang diinputkan pada field "Water Duration".
    • Contoh: Jika input Water Duration diisi 30 detik, relay akan menyala selama 30 detik, setelah hitungan mundur mencapai 00:00, relay akan mati secara otomatis dan checkbox akan menjadi unchecked.
    • Jika Water Duration kosong atau bernilai 0, relay akan tetap menyala tanpa batas waktu (unlimited) sampai relay dimatikan secara manual dengan mematikan toggle (unchecked).
  • Toggle switch ini langsung mengirimkan status (ON/OFF) ke perangkat ESP tanpa perlu menekan tombol "SET".
@Damarcreative
Damarcreative / ChaosGame.py
Created August 15, 2024 04:32
This Python script uses the Turtle graphics module to simulate the "Chaos Game," a fascinating demonstration of chaos theory and fractal geometry. The program draws a Sierpinski Triangle using random point selection and midpoint calculations. Instead of connecting lines, this implementation places colorful dots at each step, creating a visually …
import turtle
import random
# Setup the screen
screen = turtle.Screen()
screen.bgcolor("white")
# Create the turtle
t = turtle.Turtle()
t.speed(0)
import requests
import json
# URL endpoint
url = "https://gradio.hf.space/queue/join?__theme=dark"
# Header sesuai dengan yang diberikan
headers = {
'Accept': '*/*',
'Accept-Encoding': 'gzip, deflate, br, zstd',
@Damarcreative
Damarcreative / yolo_image_crop.py
Created January 25, 2024 05:34
To crop images with yolo annotations, use "makesense.ai"
from PIL import Image
import os
def read_annotations(annotation_path):
with open(annotation_path, 'r') as file:
lines = file.readlines()
annotations = []
for line in lines:
parts = line.strip().split()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Damarcreative
Damarcreative / sentiment_analysis_example.py
Created December 1, 2023 02:58
Example of using the transformer library from Hugging Face for Machine Learning tasks like NLP.
# Dependency installation
!pip install transformers
# Import libraries
import torch
from transformers import pipeline, AutoModelForSequenceClassification, AutoTokenizer
# Function to generate predictions using a model from Hugging Face
def predict_sentiment(model, tokenizer, text):
inputs = tokenizer(text, return_tensors="pt")