Skip to content

Instantly share code, notes, and snippets.

@lechuhuuha
lechuhuuha / setup.txt
Last active December 1, 2024 14:33
Setup minio + elasticsearch + apache tika + mongodb
### Elasticsearch
sysctl -w vm.max_map_count=262144
sudo sysctl -p
1. docker network create elastic
2. docker pull docker.elastic.co/elasticsearch/elasticsearch:8.16.0
3. docker run -d --name es01 --net elastic -p 9200:9200 -it -m 2GB docker.elastic.co/elasticsearch/elasticsearch:8.16.0
1. docker logs -f es01
1. Đợi logs ra password và token
4. export ELASTIC_PASSWORD="your_password"
@lechuhuuha
lechuhuuha / text.txt
Created November 12, 2024 01:44
install collab office local
mở command line trên windows
chạy dưới quyền administrator
wsl --install -d Ubuntu-22.04
sau khi cài xong
nhấn nút windows
tìm kiếm Ubuntu rồi mở
<script lang="ts" setup>
import { AliasListResponse, IAlias } from '@/interfaces/IAlias';
import { t } from '@/plugins/i18n';
import { ListAliasRequest } from '@/request/alias/request';
import { AliasStore } from '@/stores/alias-store';
import { ref } from 'vue';
const route = useRoute();
const aliasStore = AliasStore();
const params = ref<{ nodeId: string }>(route.params as { nodeId: string });
package http
import (
"embed"
"errors"
"io/fs"
"net/http"
"path/filepath"
"github.com/gin-contrib/static"
@lechuhuuha
lechuhuuha / testdns2.py
Last active August 29, 2024 01:52
use mutil threading for calling socket request to domains, skip any domains that does not respond after 30 seconds
#!/usr/bin/env python3
"""
Compares output of URLFWD records to URL Redirects
$ python3 check_url_redirects.py <apikey>
Prerequisites:
Python 3 install
pip install requests pydig
#!/usr/bin/env python3
"""
Compares output of URLFWD records to URL Redirects
$ python3 check_url_redirects.py <apikey>
Prerequisites:
Python 3 install
pip install requests pydig
<?php
function createField($H, $W)
{
$field = array();
for ($i = 0; $i < $H; $i++) {
$field[] = array_fill(0, $W, '.');
}
return $field;
}
<?php
function createField($H, $W)
{
$field = array();
for ($i = 0; $i < $H; $i++) {
$field[] = array_fill(0, $W, '.');
}
return $field;
}
<?php
function count_highlighted_letters($L, $N, $selections)
{
// Initialize an array to keep track of highlighted status for each character in S
$highlighted = array_fill(0, $L, false);
// Process each selection
foreach ($selections as $selection) {
list($a, $b) = $selection;
// Convert to 0-based index
@lechuhuuha
lechuhuuha / upload file.ts
Created June 12, 2024 07:43
upload file from read stream
import fs from 'fs';
import path from 'path';
import axios from 'axios';
import FormData from 'form-data';
// Path to the file you want to upload
const filePath: string = path.join(__dirname, 'yourfile.txt');
// URL of the remote server
const url: string = 'https://example.com/upload';