Skip to content

Instantly share code, notes, and snippets.

View hoai's full-sized avatar

hoai hoai

View GitHub Profile
@hoai
hoai / youtube-search.php
Created June 20, 2024 04:11 — forked from tszym/youtube-search.php
Youtube Data API v3 - Search videos
<?php
// ...
if ($client->getAccessToken()) {
// Create analytics service object.
$youtube = new Google_Service_YouTube($client);
try {
$keySearch = isset($_POST['key']) ? $_POST['key'] : '';
@hoai
hoai / GitConfigHttpProxy.md
Created May 9, 2024 02:44 — forked from evantoli/GitConfigHttpProxy.md
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like:

@hoai
hoai / Socks5.cs
Created March 29, 2024 07:47 — forked from zHaytam/Socks5.cs
A Socks5 implementation in .NET Core (C# 8)
using System;
using System.Globalization;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
namespace Socks
{
public static class Socks5
@hoai
hoai / Visual Studio 2022 Product Key
Created March 12, 2024 07:47 — forked from pablotolentino/Visual Studio 2022 Product Key
Visual Studio 2022 Enterprise Product key
Visual Studio 2022
Enterprise :
VHF9H-NXBBB-638P6-6JHCY-88JWH
Professional:
TD244-P4NB7-YQ6XK-Y8MMM-YWV2J
@hoai
hoai / forticlientsslvpn-expect.sh
Created March 4, 2024 14:39 — forked from mgeeky/forticlientsslvpn-expect.sh
Simple script intended to automate Fortinet SSL VPN Client connection on Linux using expect scripting.
#!/bin/bash
# Forticlient SSL VPN Client launching script utilizing expect.
# --------------------------------------------
# CONFIGURATION
# If empty - script will take some simple logic to locate appropriate binary.
FORTICLIENT_PATH=""
@hoai
hoai / text_suggest_edge.xml
Created January 4, 2024 14:18 — forked from peaeater/text_suggest_edge.xml
Text suggest edge Solr field type
<fieldType name="text_suggest_edge" class="solr.TextField">
<analyzer type="index">
<charFilter class="solr.MappingCharFilterFactory" mapping="mapping-ISOLatin1Accent.txt"/>
<tokenizer class="solr.KeywordTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.PatternReplaceFilterFactory" pattern="([\.,;:-_])" replacement=" " replace="all"/>
<filter class="solr.EdgeNGramFilterFactory" maxGramSize="30" minGramSize="1"/>
<filter class="solr.PatternReplaceFilterFactory" pattern="([^\w\d\*æøåÆØÅ ])" replacement="" replace="all"/>
</analyzer>
<analyzer type="query">
@hoai
hoai / nonConcurrentScript.php
Created December 11, 2023 07:01 — forked from RWhar/nonConcurrentScript.php
Prevent concurrent execution of PHP Script
/**
* Creates an exclusive lock
* @param $lockDir Directory to create/access lock file
* @param $lockName Name for lock
* @param $lockHandle Reference to scope var to maintain file handle after lock call completes
* @return bool
* @throws Exception on $lockdir not writable, unable to create file handle, unable to obtain ex_lock
*/
function lock($lockDir, $lockName, &$lockHandle)
{
@hoai
hoai / docker-expose-vs-ports.md
Created December 5, 2023 15:09 — forked from ThinhPhan/docker-expose-vs-ports.md
Docker expose vs ports

ports

  1. Activates the container to listen for specified port(s) from the world outside of the docker(can be same host machine or a different machine) AND also accessible world inside docker.
  2. More than one port can be specified (that's is why ports not port)

docker port

expose

  1. Activates container to listen for a specific port only from the world inside of docker AND not accessible world outside of the docker.
@hoai
hoai / my.cnf
Created December 5, 2023 06:14 — forked from fevangelou/my.cnf
Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers)
# === Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers) ===
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# ~ Updated December 2021 ~
#
#
# The settings provided below are a starting point for a 8-16 GB RAM server with 4-8 CPU cores.
# If you have different resources available you should adjust accordingly to save CPU, RAM & disk I/O usage.
#
@hoai
hoai / Dockerfile - PHP and Apache
Created December 5, 2023 02:26 — forked from LouisBertin/Dockerfile - PHP and Apache
Production ready Dockerfile for PHP and Apache
FROM php:7.4-apache
WORKDIR /app
# update & upgrade
RUN apt-get update -y && apt-get upgrade -y && apt-get install apt-utils -y
# Php extensions
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
RUN install-php-extensions intl bcmath gd pdo_mysql opcache uuid exif pcntl zip