Skip to content

Instantly share code, notes, and snippets.

View nghinv's full-sized avatar

NGUYEN VAN Nghi nghinv

  • ONVN
  • Ha Noi, Viet Nam
View GitHub Profile
@nghinv
nghinv / logstash-output-sentry.md
Created June 20, 2021 09:21 — forked from adrienmo/logstash-output-sentry.md
Logstash output to Sentry plugin + logstash configuration example

To install the plugin you can create a folder for logstash plugins, e.g. :

/etc/logstash/plugins/

Be sure you respect logstash requirements about the plugin path "$PATH/logstash/TYPE/NAME.rb", e.g. :

/etc/logstash/plugins/logstash/outputs/sentry.rb

Then start logstash manually with the options :

@nghinv
nghinv / logstash-sentry.rb
Created June 20, 2021 07:58 — forked from clarkdave/logstash-sentry.rb
(Logstash) Sentry output plugin
# The MIT License (MIT)
# Copyright (c) 2014 Dave Clark
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@nghinv
nghinv / gherkin.xml
Created August 20, 2020 07:05 — forked from Fusselwurm/gherkin.xml
gherkin syntax highlighting for kde/katepart. not of my making, but copied from http://paste.kde.org/184712/
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<!--
Gherkin (English) syntax highlighting definition for Kate.
Copyright (C) 2011 by Torbjörn Klatt (opensource@torbjoern-klatt.de)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@nghinv
nghinv / config-git-proxy.txt
Created April 9, 2020 10:42 — forked from bynil/config-git-proxy.txt
Use git over socks5 proxy
Port: 1080
1. Create a file /YOUR PATH/gitproxy.sh with content:
#!/bin/sh
nc -X 5 -x 127.0.0.1:1080 "$@"
2. Edit your ~/.gitconfig
# For git://
@nghinv
nghinv / install-openvpn-24.sh
Created February 28, 2020 11:02 — forked from tienthanh2509/install-openvpn-24.sh
Install OpenVPN 2.4.x on Ubuntu 16.04 Xenial
curl -s https://swupdate.openvpn.net/repos/repo-public.gpg | apt-key add -
echo "deb http://build.openvpn.net/debian/openvpn/stable xenial main" > /etc/apt/sources.list.d/openvpn-aptrepo.list
apt update
apt install -y openvpn
@nghinv
nghinv / nginx.conf
Created February 25, 2020 07:58 — forked from baskaran-md/nginx.conf
NginX allow POST on static pages.
# ...
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
@nghinv
nghinv / cas-auth.js
Created February 25, 2020 03:20 — forked from tfcporciuncula/cas-auth.js
CAS authentication script for OWASP Zed Attack Proxy (ZAP or ZAProxy)
/*
* This script is intended to handle CAS (http://jasig.github.io/cas) authentication via ZAP.
*
* When working with CAS, a single POST request with the credentials is not enough to trigger the authentication.
* When we GET the login page, some input values used by CAS are generated (the login ticket and some Spring Web
* Flow related parameters), and they must be included in the POST request for the authentication to work. So
* this script basically sends a GET to the login page, parses its response looking for the values generated by
* CAS, and sends a POST request with these values and the credentials.
*
* This is enough to trigger the authentication, but it's not enough to enable a successfull authenticated scan
@nghinv
nghinv / nginx.conf
Created February 24, 2020 08:33 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@nghinv
nghinv / nginx.conf
Created February 14, 2020 05:05 — forked from morhekil/nginx.conf
Full request/response body logging in nginx
http {
log_format bodylog '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" $request_time '
'<"$request_body" >"$resp_body"';
lua_need_request_body on;
set $resp_body "";
body_filter_by_lua '
@nghinv
nghinv / postgres_queries_and_commands.sql
Created October 16, 2019 11:25 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'