Skip to content

Instantly share code, notes, and snippets.

View arma7x's full-sized avatar
🎯
Focusing

Ahmad Malik arma7x

🎯
Focusing
  • PayPal ahmadmuhamad101@gmail.com
  • MY
View GitHub Profile
@arma7x
arma7x / sql
Created August 28, 2023 14:18
sort order by sold
CREATE TEMPORARY TABLE `orders` (
`ID` int NOT NULL AUTO_INCREMENT,
`Category` varchar(255) NOT NULL,
`SKU` varchar(255) NOT NULL,
`open_flag` tinyint(1) NOT NULL,
PRIMARY KEY (`ID`)
);
INSERT INTO `orders` (`ID`, `Category`, `SKU`, `open_flag`) VALUES
(1, 'ABC', '1', 0),
@arma7x
arma7x / Dockerfile
Created August 7, 2023 15:25
docker-compose-example
FROM alpine
RUN mkdir -p /home
ENTRYPOINT ["tail", "-f", "/dev/null"]
@arma7x
arma7x / Dockerfile
Created August 7, 2023 06:53
Hello Docker
FROM alpine
RUN mkdir -p /home
WORKDIR /home
COPY ./ ./
CMD ["uname", "-r"]
# docker build -t hello_docker .
# docker run hello_docker
# docker run -it hello_docker /bin/sh
# docker run -it -v .\:/home hello_docker /bin/sh
@arma7x
arma7x / validator.php
Created July 17, 2023 16:24
PHP Validator
<?php
$FAKE_POST = [
"age" => "5",
"name" => "Johny",
"species" => "cat",
];
$ERRORS = [];
@arma7x
arma7x / queue.js
Created July 13, 2023 15:46
Simple queue in JS
let isRunning = false;
let cursor = -1;
let jobs = {};
let completed = new Set();
const JOB_TIMEOUT = 1500;
const QUEUE_INTERVAL = 2000;
function insertTask(key, value) {
const unique = key.toString();
@arma7x
arma7x / DropdownMenu.tsx
Created June 2, 2023 04:20
Dropdown menu with react
//import { useState } from 'react';
const { useState } = React;
const DropdownMenu = () => {
const pointer = { cursor: 'pointer' }
const [count, setCount] = useState(0)
const [visibility, setVisibility] = useState(false)
const [right, setRight] = useState(0)
const [top, setTop] = useState(0)
@arma7x
arma7x / mapping.js
Created May 13, 2023 10:33
Peta Transit Berintegrasi Lembah Kelang
// https://www.malaysiatercinta.com/2016/09/peta-laluan-lrt-monorel-ktm-erl-mrt.html
var data = `
1. KTM Komuter Laluan Batu Caves - Pulau Sebang
BATU CAVES - Taman Wahyu - Kampung Batu - Batu Kentomen - Sentul - Putra - Bank Negara - Kuala Lumpur - KL Sentral - Mid Valley - Seputeh - Salak Selatan - Bandar Tasik Selatan - Serdang - Kajang - Kajang 2 - UKM - Bangi - Batang Benar - Nilai - Labu - Tiroi - Seremban - Senawang - Sungai Gadut - Rembau - TAMPIN / PULAU SEBANG
------------------------
2. KTM Komuter Laluan Tanjung Malim - Pelabuhan Klang
TANJUNG MALIM - Kuala Kubu Bharu - Rasa - Batang Kali - Serendah - Rawang - Kuang - Sungai Buloh - Kepong Sentral - Kepong - Segambut - Putra - Bank Negara - Kuala Lumpur - KL Sentral - Abdullah Hukum - Angkasapuri - Pantai Dalam - Petaling - Jalan Templer - Kampung Dato Harun - Seri Setia - Setia Jaya - Subang Jaya - Batu Tiga - Shah Alam - Padang Jawa - Bukit Badak - Klang - Teluk Pulai - Teluk Gadong - Kampung Raja Uda - Jalan Kastam - PELABUHAN KLANG
----------
@arma7x
arma7x / Generic.go
Last active February 19, 2023 17:48
Golang generic
package main
import "fmt"
type Number interface {
int64 | float64
}
type Common[N Number] interface {
Less(Common[N]) bool
#if CONFIG_FREERTOS_UNICORE
#define ARDUINO_RUNNING_CORE 0
#else
#define ARDUINO_RUNNING_CORE 1
#endif
#ifndef LED_BUILTIN
#define LED_BUILTIN 13
#endif
/*********
Rui Santos
Complete project details at https://RandomNerdTutorials.com/esp32-websocket-server-arduino/
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
*********/
#ifdef __cplusplus
extern "C" {
#endif
uint8_t temprature_sens_read();