Skip to content

Instantly share code, notes, and snippets.

View ekapujiw2002's full-sized avatar

Eka Puji Widiyanto ekapujiw2002

View GitHub Profile
@Guiforge
Guiforge / gather_limit.py
Last active May 17, 2024 09:42
asyncio.gather with max number of concurrent tasks.
import asyncio
from collections.abc import Coroutine
from typing import Any
async def gather_limit(
*tasks: Coroutine[None, None, Any],
return_exceptions: bool = False,
max_con: int = 100,
) -> Any:
@narutaro
narutaro / mqtt-in-your-browser.md
Last active July 27, 2025 19:31
MQTT in your browser

MQTT in your browser

MQTT is probably best known as a lightweight messaging protocol implemented for small sensors, but there is actually a JavaScript implementation called MQTT.js. It's a JavaScript implementation, so of course it works in a browser. I think it's a great option for front-end engineers who are working with MQTT/IoT-related projects (for example, creating a dashboard to visualize MQTT data). In this article, I'd like to write about what I did when I tried to connect MQTT.js to the test server (broker) of Mosquitto™.

@kaenova
kaenova / TextCleaning.py
Created August 20, 2021 04:29
Indonesian Text Cleaning with Sastrawi Library
import pandas as pd
import re
import string
from tqdm import tqdm
from Sastrawi.Stemmer.StemmerFactory import StemmerFactory
class DataCleaning:
# Initialization
factory = StemmerFactory()
stemmer = factory.create_stemmer()
@Jiab77
Jiab77 / setup-nut-and-netdata-on-ubuntu.md
Last active September 12, 2025 16:55
In this document, I will explain how to setup nut (Network UPS Tools) on Ubuntu 18.04 and 20.04.

Setup nut and netdata on Ubuntu

In this document, I will explain how to setup nut (Network UPS Tools) on Ubuntu 18.04 and 20.04.

It is basically the next chapter of my previous gist, Upgrade nut on Ubuntu 18.04.

I'll only document USB connected UPS and not the other supported connection modes.

Install required dependencies

@cagbal
cagbal / client.py
Created April 1, 2021 14:33 — forked from ilomon10/client.py
Send image as base64 buffer from client (python opencv) to server (nodejs) using SocketIO
import cv2
import socketio #python-socketio by @miguelgrinberg
import base64
sio = socketio.Client()
sio.connect('http://x.x.x.x:xxxx)
cam = cv2.VideoCapture(0)
while (True):
@corenel
corenel / README.md
Last active June 17, 2024 02:46
RTSP Port Forwarding

之前在这里研究过的用iptables配置跨网段的端口转发

Assume we have the following network environments:

  • Device:
    • eth0 (192.168.6.59): for external access
    • enx000ec6a490c5 (192.168.1.2): for ip camera
  • IP Camera:192.168.1.10
  • PC:192.168.6.2
@betterdatascience
betterdatascience / app.py
Created October 5, 2020 18:44
Python Database Driven REST API
from flask import Flask, request, jsonify
from flask_sqlalchemy import SQLAlchemy
from flask_marshmallow import Marshmallow
from flask_restful import Resource, Api
app = Flask(__name__)
api = Api(app)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///users.db'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
@nonsintetic
nonsintetic / struct_union.ino
Last active August 11, 2023 00:23
Arduino structures and unions
/* Arduino data manipulation and concatenation with structures and unions
*
* This simple (ish) sketch shows you how to organize your data into a struct
* and then access the whole thing as a byte array.
*
* Useful if you want to concatenate several variables into a single byte array
* to send over bluetooth, i2c, lora or any other protocol that works with arrays.
* In other words you have a fixed byte array, and we squeeze in variables of different
* data types and lengths into it, while still using it as a byte array afterwards.
*
@TheZoc
TheZoc / Setting up guide for ArchLinux on Raspberry Pi.md
Last active September 5, 2025 20:20
This is a guide to setup Arch Linux in Raspberry Pi 4, using macOS as the auxiliary system.

Raspberry Pi Setup Guide

This guide will use either a macOS or an ArchLinux base system, to prepare a microSD card with Arch Linux for Raspberry Pi.

If someone managed to do the initial setup using Windows, please let me know, so I can add to this guide.

This guide will be verbose at times for some simple tasks. This is intended to help people just starting out, so it's not confusing. If something confuses you, let me know and I'll try my best to answer it.

@p3jitnath
p3jitnath / opencv-fonts.py
Created June 29, 2020 06:21
Custom OpenCV font
import cv2
import numpy as np
img = np.zeros((100, 300, 3), dtype=np.uint8)
ft = cv2.freetype.createFreeType2()
ft.loadFontData(fontFileName='Ubuntu-R.ttf',
id=0)
ft.putText(img=img,
text='Quick Fox',