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 / printChar.php
Created December 14, 2020 18:37
Some challenge from CTO GHN at 2017
<?php
$sizePrint = 10;
for ($row=1; $row<=$sizePrint; $row++)
{
for ($column=1; $column<=$sizePrint; $column++)
{
$totalColRow = $row+$column;
@tranphuoctien
tranphuoctien / query.sql
Created December 14, 2020 10:43
Query JSON in mysql data array[]
# Data in column alert
|alert
'[{"days": 2, "past": true, "time": 1607299200, "hours": 0, "weeks": 0, "minutes": 0, "seconds": 0}, "description": "Reminder"}]';
SELECT *
FROM
WHERE alert->'$[*].trigger.time' <= JSON_ARRAY(1607731200);
@tranphuoctien
tranphuoctien / install_golang.sh
Created November 29, 2020 12:11
install script golaing
#! /bin/bash
set -euf -o pipefail
# Install pre-reqs
sudo apt-get install python3 git -y
o=$(python3 -c $'import os\nprint(os.get_blocking(0))\nos.set_blocking(0, True)')
#Download Latest Go
GOURLREGEX='https://dl.google.com/go/go[0-9\.]+\.linux-amd64.tar.gz'
echo "Finding latest version of Go for AMD64..."
@tranphuoctien
tranphuoctien / default.conf
Last active November 23, 2020 09:15
Nginx rate limit
upstream myapp {
server 127.0.0.1:8081;
}
limit_req_zone $binary_remote_addr zone=login:10m rate=1r/s;
server {
listen 80;
@tranphuoctien
tranphuoctien / cc-validate.html
Created November 13, 2020 01:59
Credit card validate
<!DOCTYPE html>
<html>
<head>
<title>Credit card validate</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js" integrity="sha512-bLT0Qm9VnAYZDflyKcBaQ2gg0hSYNQrJ8RilYldYQ1FxQYoCLtUjuuRuZo+fjqhx/qtq/1itJ0C2ejDxltZVFg==" crossorigin="anonymous"></script>
<script>
/*
* Display error message based on current element's data attributes
*/
function cgToggleError(element, status) {
@tranphuoctien
tranphuoctien / backup it
Created October 9, 2020 03:28
Stored cmd code json query
cmd jqplay with gin : https://github.com/owenthereal/jqplay
@tranphuoctien
tranphuoctien / log-helper.js
Created October 8, 2020 03:06
How to gen log as terminal
(function (global) {
var pad = function (num, len) {
num = '' + num
while (num.length < len) {
num = '0' + num
}
return num
}
var time = function () {
@tranphuoctien
tranphuoctien / SrBM.py
Created October 2, 2020 04:27
ddos by proxies
import requests, random, threading, time
URL = 'https://chiasenhac.vn/'
Request_Type = 'get'
JSON_Data = {} #Gets ignored if Request_Type is GET
#Lower=faster but more proxies get skiped because of multi-threading
timeout = 6
@tranphuoctien
tranphuoctien / gmailAPI2IMAP.js
Created July 30, 2020 04:41
convert gmail api response to imap structure data.
const { Base64 } = require('js-base64');
const _ = require('underscore');
const { parseAddresses } = require('mimelib');
const { isArray } = require('underscore');
/**
* Decodes a url safe Base64 string to its original representation.
* @param {string} string
* @return {string}
*/
function urlB64Decode(string = '', isText = false) {
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions