Skip to content

Instantly share code, notes, and snippets.

View aamsur-mkt's full-sized avatar

Aam S aamsur-mkt

View GitHub Profile
x-ses-message-tags: team=publishing, env=staging, action=sendemailverification
x-ses-configuration-set: bounce-notification
From: [email protected]
To: [email protected]
Subject: Subject
Content-Type: multipart/alternative;
boundary="----=_boundary"
------=_boundary
Content-Type: text/plain; charset=UTF-8
@aamsur-mkt
aamsur-mkt / common-elk-error.md
Created October 22, 2020 07:46
Common error ELK

["warning","monitoring","kibana-monitoring"],"pid":6,"message":"Error: [circuit_breaking_exception] [parent] Data too large, data for [<http_request>] would be [1550087672/1.4gb], which is larger than the limit of [1477659852/1.3gb], real usage: [1550085280/1.4gb], new bytes reserved: [2392/2.3kb], usages [request=0/0b, fielddata=1359/1.3kb, in_flight_requests=2392/2.3kb, accounting=216950274/206.8mb]

try increase the memory -Xms4g -Xmx4g https://discuss.elastic.co/t/i-got-issue-about-data-too-large/185087

@aamsur-mkt
aamsur-mkt / replace-update-like.sql
Created October 21, 2020 08:01
Mysql Query for UPDATE and REPLACE part of a string
update article set old_body = REPLACE(old_body, 'href="/group/kmon', 'href="https://km.pgn.co.id/group/kmon') where old_body like '%href="/group/kmon%'
@aamsur-mkt
aamsur-mkt / nginx-anticlickjacking.conf
Created October 16, 2020 14:44
Example Clickjacking
## Anti Clickjacking
add_header x-frame-options "SAMEORIGIN";
add_header Content-Security-Policy "frame-ancestors 'self' www.klikdokter.com klikdokter.com m.klikdokter.com www.lifebuoy.co.id lifebuoy.co.id wecare.id";
@aamsur-mkt
aamsur-mkt / fix-slave-query-error.sql
Created October 16, 2020 08:50
Skip Myqsl Slave Query
Sometime we will see an error like
```bash
Replication reported error 1396:
Error 'Operation ALTER USER failed for 'dba1'@'localhost'' on query.
Default database: 'mysql'.
Query: 'ALTER USER 'dba1'@'localhost' IDENTIFIED WITH 'mysql_native_password' AS '*DAB3A57F75AD41285552E115420DA2EFD756CD19''
```
I will skip that query which makes our slave server stuck.
Use the below command to fix.
@aamsur-mkt
aamsur-mkt / ThrottleRequests.php
Created October 12, 2020 04:51 — forked from developerdino/ThrottleRequests.php
Lumen Middleware for rate limiting - based on Laravel's implementation.
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Response;
use Illuminate\Cache\RateLimiter;
class ThrottleRequests
{
@aamsur-mkt
aamsur-mkt / install-ldap.md
Last active October 8, 2020 15:16
Install LDAP Ubuntu / Debian / Kali
@aamsur-mkt
aamsur-mkt / prevent-update-package.md
Created October 2, 2020 09:23
Hold or prevent updating of a specific package Linux Ubuntu

Holding

There are four ways of holding back packages: with dpkg, apt, aptitude or dselect.

dpkg

Put a package on hold:

echo "<package-name> hold" | sudo dpkg --set-selections
@aamsur-mkt
aamsur-mkt / install-awscli.sh
Created October 1, 2020 09:22
Install awscli with cp and sync Ubuntu 18.04
sudo apt-get install -y awscli python-s3transfer
@aamsur-mkt
aamsur-mkt / install-pm2.sh
Created September 23, 2020 17:42
Install pm2 without Node & Npm
wget -qO- https://getpm2.com/install.sh | bash