Skip to content

Instantly share code, notes, and snippets.

View h4ck4life's full-sized avatar

Alif h4ck4life

  • Dev.
  • Kuala Lumpur
View GitHub Profile
@h4ck4life
h4ck4life / docker-compose.yml
Created January 9, 2025 14:15
Mongodb docker compose
version: '3.8'
services:
mongodb:
image: mongo:7.0
container_name: mongodb
environment:
- MONGO_INITDB_ROOT_USERNAME=mongo
- MONGO_INITDB_ROOT_PASSWORD=mongo
- MONGO_INITDB_DATABASE=mongodb
@h4ck4life
h4ck4life / docker-compose.yml
Created January 9, 2025 12:29
Docker compose for Postgres
version: '3.8'
services:
postgres:
image: postgres:16
container_name: postgres
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=postgres
@h4ck4life
h4ck4life / docker-compose.yml
Last active January 9, 2025 12:24
Docker compose for qdrant
version: '3.8'
services:
qdrant:
image: qdrant/qdrant
container_name: qdrant
environment:
- QDRANT__SERVICE__API_KEY=your_secret_api_key_here
volumes:
- qdrant_data:/qdrant/storage
@h4ck4life
h4ck4life / docker-compose.yml
Created January 8, 2025 08:58
n8n workflow docker compose
version: "3.7"
services:
n8n:
image: docker.n8n.io/n8nio/n8n
restart: always
environment:
- N8N_HOST=n8n.malif.dev
- N8N_PORT=5678
- N8N_PROTOCOL=https
- NODE_ENV=production
@h4ck4life
h4ck4life / Dockerfile
Created January 8, 2024 07:47
PHP-FPM dockerfile with sendmail enabled
FROM php:7.4-fpm
# Install dependencies
RUN apt-get update && \
apt-get install -y telnet curl unixodbc unixodbc-dev gnupg2 libgssapi-krb5-2 wget iputils-ping openssl zlib1g-dev libzip-dev sendmail
# Add Microsoft repo for SQL Server ODBC Driver
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
curl https://packages.microsoft.com/config/debian/10/prod.list > /etc/apt/sources.list.d/mssql-release.list
@h4ck4life
h4ck4life / main.go
Created December 31, 2023 03:08
Run go pprof with API server
package main
import (
"fmt"
"log"
"net/http"
_ "net/http/pprof" // Import for pprof
)
func main() {
@h4ck4life
h4ck4life / Dockerfile
Created December 28, 2023 15:09
golang + sqlite3 dockerfile
FROM golang:alpine3.18 AS build
# Important:
# Because this is a CGO enabled package, you are required to set it as 1.
ENV CGO_ENABLED=1
RUN apk add --no-cache \
# Important: required for go-sqlite3
gcc \
# Required for Alpine
@h4ck4life
h4ck4life / convert_sast_to_html_args.py
Created December 4, 2023 07:37
Gitlab SAST result HTML converter
import json
import sys
def parse_json_to_html(json_data):
vulnerabilities = json_data.get('vulnerabilities', [])
# Start HTML document
html = '''
<html>
<head>
@h4ck4life
h4ck4life / Scratch.java
Created December 2, 2022 18:21
Example code to find multiple JSON string in a text
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Scratch {
public static void main(String[] args) {
String text = "This text contains two JSON strings: {\"key1\": \"value1\"} and {\"key2\": \"value2\"} and {\"key2\": \"value2\"}";
Pattern pattern = Pattern.compile("(\\{.*?\\})");
Matcher matcher = pattern.matcher(text);
while (matcher.find()) {
@h4ck4life
h4ck4life / MessageQueueSpy.js
Created June 25, 2021 11:00 — forked from axemclion/MessageQueueSpy.js
Message Queue - Replay React Native Message Queue
import MessageQueue from 'react-native/Libraries/BatchedBridge/MessageQueue.js';
const WHITELIST = ['UIManager'];
const NOOP = () => { };
let queue = [];
let now = 0;
export default {
start() {
MessageQueue.spy(msg => {