Skip to content

Instantly share code, notes, and snippets.

Đào Hoàng Sơn daohoangson

Block or report user

Report or block daohoangson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@daohoangson
daohoangson / proxy.php
Last active Sep 20, 2018
Simple PHP proxy script
View proxy.php
<?php
$url = 'https://httpbin.org/anything?';
function proxyDoHeader($curl, $headerLine)
{
$trimmed = trim($headerLine);
if (strlen($trimmed) > 0 && !preg_match('/^(Date|Server|Transfer)/', $trimmed)) {
header($trimmed);
}
@daohoangson
daohoangson / build.php
Last active Dec 15, 2017
Simple script demo for [bd] API add-on for XenForo (https://github.com/xfrocks/bdApi). For complete demo, see http://j.mp/1BA1CzC
View build.php
<?php declare(strict_types=1);
$inputPath = __DIR__ . '/script.php';
$outputPath = __DIR__ . '/script.min.php';
$markerStart = "/* API SCRIPT FUNCTIONS START */\n";
$markerEnd = "/* API SCRIPT FUNCTIONS END */\n";
$lines = file($inputPath);
$f = fopen($outputPath, 'w');
$buffer = null;
@daohoangson
daohoangson / sample.js
Last active Dec 3, 2017
AES128 CBC encryption
View sample.js
// input
const secret = 'top secret'
const userData = {'version_id': 1, 'user_id': 123, 'username': 'xxx'}
// prepare
const password = crypto.createHash('md5').update(secret).digest()
const json = JSON.stringify(userData)
const cipher = 'aes-128-cbc'
const ivLength = 16
View curator_cli.sh
#!/bin/sh
docker run --rm -it --network=bkvn_default --entrypoint=curator_cli olalonde/curator \
--host elasticsearch \
delete_indices \
--filter_list '[{"filtertype":"age","source":"creation_date","direction":"older","unit":"days","unit_count":7},{"filtertype":"pattern","kind":"prefix","value":"logstash"}]'
View wtf.html
<!DOCTYPE html>
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="google-site-verification" content="ht9lmeQSHFSNMyrd1PcB-qqzkNuw5M5lN_L6eYEfWIU">
<meta name="description" content="Đây là phần mềm tự động tăng view theo từ khóa và link đã định trước. Yêu mến CSM hãy chạy link này thường xuyên">
<meta name="keywords" content="cuoc song moi,cong ty cuoc song moi,ky nang mem,danh thuc tiem nang,huan luyen tam ly dac biet,lieu kim thuy,dao tao ky nang,huan luyen ky nang,ky nang ban hang,ky nang giao tiep, ">
View functions.js
initGet: function() {
var hash = document.location.hash;
if (hash == '#_=_' || hash.indexOf('#.') > -1) {
hash = '';
}
if (hash.length > 2) {
var pfTime = uix.time();
var $target = $(hash);
if ($target.length) {
uix.fixScrollLocation.topOffset = $target.offset().top;
View CodeEvent.php
<?php
public static function fire($event, array $args = array(), $hint = null)
{
(strpos($event, 'template') === false && (strpos($event, 'load_class') === false || $event === 'load_class') && setHeaderTimer($hint ? $hint : $event));
...
}
View config.php
<?php
$config['db']['host'] = 'mysql';
$config['db']['port'] = '3306';
$config['db']['username'] = 'root';
$config['db']['password'] = 'root';
$config['db']['dbname'] = 'xenforo';
if (preg_match('/^xenforo-(?<dbname>[a-z]+)\./', $_SERVER['SERVER_NAME'], $serverNameMatches)) {
$config['db']['dbname'] = $serverNameMatches['dbname'];
You can’t perform that action at this time.