Skip to content

Instantly share code, notes, and snippets.

View mwafa's full-sized avatar

Muhammad Wafa mwafa

View GitHub Profile
@mwafa
mwafa / log.h
Created March 8, 2025 14:11
Enhanced Logging with Log Levels and Custom Tags in the Arduino Framework
#ifndef __LOG_H__
#define __LOG_H__
#define LOG_LEVEL_FATAL 0
#define LOG_LEVEL_ERROR 1
#define LOG_LEVEL_WARN 2
#define LOG_LEVEL_INFO 3
#define LOG_LEVEL_DEBUG 4
#define LOG_LEVEL_VERBOSE 5
@mwafa
mwafa / board.h
Created June 22, 2024 14:24
TOFU Board FIle
#ifndef __BOARD_TOFU_H__
#define __BOARD_TOFU_H__
#define TOFU_BUTTON1_PIN 33
#define TOFU_BUTTON2_PIN 25
#define TOFU_BUTTON3_PIN 32
#define TOFU_NOTIFICATION_PIN 4
#define TOFU_STEPUP_PIN 14
@mwafa
mwafa / typescript.json
Created July 23, 2021 23:38
Typescript dan Typescript-React User Snippet for Vscode
{
"Create Next Api": {
"prefix": "nextapi",
"body": [
"import { NextApiRequest, NextApiResponse } from \"next\"",
"export default async (req: NextApiRequest, res: NextApiResponse) => {",
" try {",
" switch (req.method) {",
" default:",
" throw new Error()",
@mwafa
mwafa / debounce.md
Last active March 8, 2025 14:23
Debounce on React

Basic hook

function useDebounce(state, timeout){
  const [current, setState] = useState(state)

  useEffect(() => {
    const run = setTimeout(() => {
      setState(state)
 }, timeout)
@mwafa
mwafa / show-me.js
Created March 22, 2021 12:24
console me
console.log(
"%cSistem ini dibuat oleh:\n\n %c %c Muhammad Wafa \n",
"font-size: 16px",
"font-size:20px;padding:10px; background:url(https://github.com/mwafa.png) no-repeat;background-size: 40px 40px;",
"font-size: 20px; vertical-align:middle; font-weight:bold",
"\nGithub >> https://github.com/mwafa\n",
"\nLinkedin >>\n\n https://www.linkedin.com/in/muhammad-wafa-587440126/\n\n"
)
@mwafa
mwafa / server.yml
Created April 23, 2020 22:20
server spec
Server spec:
- RAM: 1024 MB
- CPU: 2 core
- Storage: 30 GB
Software Version:
Docker: version 18.09.7, build 2d0083d
Container:
- MYSQL: 5.7
- Redis: latest