Skip to content

Instantly share code, notes, and snippets.

View khahantk's full-sized avatar
🏠
Working from home

Chung Nguyen khahantk

🏠
Working from home
View GitHub Profile
@khahantk
khahantk / getCurrentESTDate.js
Created September 7, 2020 07:40
Get current EST date JS
function getCurrentESTDate() {
const offset = '-5'
const d = new Date();
const utc = d.getTime() + (d.getTimezoneOffset() * 60 * 1000);
return new Date(utc + (60 * 60 * 1000 * offset));
}
const currentDate = getCurrentESTDate();
@khahantk
khahantk / aemauthor.service
Last active October 14, 2018 08:44
Systemd AEM - Adobe Experience Manager (/etc/systemd/system/aemauthor.service)
[Unit]
Description=AEM Author Instance
After=network.target
[Service]
Type=simple
User=ubuntu
ExecStart=/opt/adobe/AEM/author/crx-quickstart/bin/start
ExecStop=/opt/adobe/AEM/author/crx-quickstart/bin/stop
@khahantk
khahantk / AEM cURL
Created October 12, 2018 08:16 — forked from joemaffia/AEM cURL
AEM cURL commands
Uninstall a bundle (use http://localhost:4505/system/console/bundles to access the Apache Felix web console)
curl -u admin:admin -daction=uninstall http://localhost:4505/system/console/bundles/"name of bundle"
Install a bundle
curl -u admin:admin -F action=install -F bundlestartlevel=20 -F
bundlefile=@"name of jar.jar" http://localhost:4505/system/console/bundles
Build a bundle
curl -u admin:admin -F bundleHome=/apps/centrica/bundles/name of bundle -F
descriptor=/apps/centrica/bundles/com.centrica.cq.wcm.core-bundle/name_of_bundle.bnd
@khahantk
khahantk / gist:b858ac40b9bf51e2cf1a25aa59c4639f
Last active October 18, 2018 04:37
.htaccess disable access directory wordpress, only allow access static resources wordpress, disable directory indexes
#disable access directory, only allow access static resource
RewriteRule ^(wp-content|wp-includes)/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|ico|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov|xml|ttf|woff|eot)$ - [NC,L]
RewriteRule ^(wp-content|wp-includes) index.php [NC,L]
@khahantk
khahantk / .htaccess
Created October 5, 2018 06:50
6G Firewall htaccess
# 6G FIREWALL/BLACKLIST
# @ https://perishablepress.com/6g/
# 6G:[QUERY STRINGS]
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} (eval\() [NC,OR]
RewriteCond %{QUERY_STRING} (127\.0\.0\.1) [NC,OR]
RewriteCond %{QUERY_STRING} ([a-z0-9]{2000,}) [NC,OR]
RewriteCond %{QUERY_STRING} (javascript:)(.*)(;) [NC,OR]
@khahantk
khahantk / .htaccess
Created October 5, 2018 03:28
Security Header Apache .htaccess
# security headers
# add to .htaccess
<IfModule mod_headers.c>
Header always set Referrer-Policy "no-referrer-when-downgrade"
Header set Strict-Transport-Security "max-age=31536000; includeSubDomains"
Header set X-XSS-Protection "1; mode=block"
Header always append X-Frame-Options SAMEORIGIN
Header set X-Content-Type-Options nosniff
Header set X-Permitted-Cross-Domain-Policies none
</IfModule>
@khahantk
khahantk / openresty
Created June 21, 2018 16:29 — forked from pwm/openresty
openresty init script
#!/bin/bash
#
# chkconfig: 2345 55 25
# description: Openresty
# processname: nginx
# config: /usr/local/openresty/nginx/conf/nginx.conf
# pidfile: /usr/local/openresty/nginx/logs/nginx.pid
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $local_fs $remote_fs $network $named $syslog $time
@khahantk
khahantk / application.css
Created October 18, 2017 03:37 — forked from mikeric/application.css
Rivets.js todo list demo
.done {
opacity: 0.5;
text-decoration: line-through;
}
@khahantk
khahantk / start-stop-example.sh
Created October 17, 2017 08:43 — forked from alobato/start-stop-example.sh
start-stop-example
#!/bin/sh
# Quick start-stop-daemon example, derived from Debian /etc/init.d/ssh
set -e
# Must be a valid filename
NAME=foo
PIDFILE=/var/run/$NAME.pid
#This is the command to be run, give the full pathname
DAEMON=/usr/local/bin/bar
@khahantk
khahantk / haproxy.conf
Created October 10, 2017 06:51 — forked from thpham/haproxy.conf
test config haproxy for gRPC loadbalancing
global
tune.ssl.default-dh-param 1024
defaults
timeout connect 10000ms
timeout client 60000ms
timeout server 60000ms
frontend fe_http
mode http