Skip to content

Instantly share code, notes, and snippets.

View BlackMetalz's full-sized avatar
🎯
Focusing

Luong Trung Kien BlackMetalz

🎯
Focusing
  • Hà Nội
View GitHub Profile
@kamleshchandnani
kamleshchandnani / haproxy-reqrep.md
Last active April 25, 2023 15:50
Understanding "reqrep" in HA Proxy config

Let's assume we have following line in our HA proxy file:
reqrep ^([^\ :]*)\ /api/v1/api-name/(.*) \1\ /staging/path-name/\2
Here is our sample domain:
https://example.com/api/v1/api-name/

The goal here is to rewrite /api/v1/api-name/ to /staging/path-name/ leaving anything else unchanged.

Breaking the Regex and understanding in parts:
There are basically 3 parts in the regex:

@hoangdh
hoangdh / find-command.md
Last active January 7, 2021 16:14
Câu lệnh find - Tìm kiếm file và thư mục trong linux - Tips & Tricks FIND command

Ghi chép tùy chọn của find

  • Các tùy chọn hay dùng:
    • -name: Tìm kiếm theo tên file/folder
    • -type: Theo kiểu, f: Folder; d: Directory
    • -mtime N: Thời gian tạo/chỉnh sửa. N: là số ngày
    • -exec: Thực thi gì đó với các file tìm được
    • -perm: Tìm theo quyền truy cập (RWX)
    • -user: Tìm file thuộc sở hữu của user nào đó
  • -group: Tìm file sở hữu của group nào đó
DELETE FROM creature_template WHERE entry = '90006';
INSERT INTO `creature_template` VALUES ('90006', '0', '0', '0', '0', '0', '42063', '42061', '0', '0', 'Teleporter', 'Locations', 'Directions', '55555', '90', '90', '4', '0', '35', '3', '1', '1.14286', '1', '1', '0', '0', '0', '0', '1', '0', '0', '1', '0', '2048', '0', '0', '0', '0', '0', '0', '0', '0', '7', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'SmartAI', '0', '3', '1', '12', '0', '0', '0', '0', '0', '0', '', '0', '1', '0', '0', '', '1', '1', '1', '1', '0');
DELETE FROM creature_template_addon WHERE Entry = '90006' ;
INSERT INTO creature_template_addon (entry, mount, bytes1, bytes2, emote, path_id, auras) VALUES
('90006', 0, 0, 0, 0, 0, '35766');
DELETE FROM gossip_menu WHERE entry>'55555'-1 AND entry<'55555'+9;
DELETE FROM npc_text WHERE ID>'333333'-1 AND ID<'333333'+5;
INSERT INTO gossip_menu (entry, text_id) VALUES
('55555'+4, '333333'+3),
('55555'+3, '333333'+2),
@imwilsonxu
imwilsonxu / app.py
Last active February 16, 2023 04:57
[Flask + Wtforms + Select2] #flask
# -*- coding: utf-8 -*-
from flask import Flask, request, render_template, current_app
from flask_wtf import Form
from wtforms.validators import DataRequired
from wtforms import SelectField, SelectMultipleField, SubmitField
app = Flask(__name__)
@jacurtis
jacurtis / about.blade.php
Created February 4, 2016 17:05
Build a Blog with Laravel Part 5.5 File Download
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Laravel Blog</title>
@mreschke
mreschke / nginx.conf
Last active May 14, 2024 14:54
Nginx config for multiple laravel sites based on /api/v1 url paths
# This config will host your main [Laravel] GUI application at /, and any additional [Lumen] webservices at /api/v1 and /api/v2...
# This also works perfectly for all static file content in all projects
# This is full of debug comments so you can see how to print debug output to browser! Took me hours to nail this perfect config.
# Example:
# http://example.com - Main Laravel site as usual
# http://example.com/about - Main Laravel site about page as usual
# http://example.com/robots.txt - Main Laravel site static content as usual
# http://example.com/api/v1 - Lumen v1 api default / route
# http://example.com/api/v1/ - Lumen v1 api default / route
@litnimax
litnimax / gist:1a02be9091ace89f3603
Created October 20, 2015 14:44
Flask signal example
from flask import Flask
from flaskext.sqlalchemy import SQLAlchemy, models_comitted
app = Flask(__name__)
db = SQLAlchemy(app)
class Post(db.Model):
id = db.Column('post_id', db.Integer, primary_key=True)
title = db.Column(db.String(200))
text = db.Column(db.String)
@mattmezza
mattmezza / vhost.sh
Last active November 30, 2023 08:30
bash script to create virtual host vhost with apache httpd and CentOs 7
#!/bin/bash
# This script is used for create virtual hosts on CentOs.
# Created by alexnogard from http://alexnogard.com
# Improved by mattmezza from http://you.canmakethat.com
# Feel free to modify it
# PARAMETERS
#
# $usr - User
# $dir - directory of web files
# $servn - webserver address without www.