Skip to content

Instantly share code, notes, and snippets.

View PanupongDeve's full-sized avatar
🐱
Meow Meow

Panupong Chamsomboon PanupongDeve

🐱
Meow Meow
View GitHub Profile
@PanupongDeve
PanupongDeve / load_dotenv.sh
Created March 22, 2022 06:26 — forked from mihow/load_dotenv.sh
Load environment variables from dotenv / .env file in Bash
if [ ! -f .env ]
then
export $(cat .env | xargs)
fi
[servers]
<ip-server> ansible_user=ubuntu ansible_ssh_private_key_file=<private key server>
[servers:vars]
ansible_ssh_common_args='-o ProxyCommand=\"ssh -q ubuntu@<ip-jumbox>-o IdentityFile=<private key jumpbox> -o Port=22 -W %h:%p\"'

Security Checklist

Kube Security

  • 1. อย่า Run Docker โดย root user
  • 2. ควรจะใช้ package docker file ที่เราจะใช้เท่านั้น
  • 3. Node ควรจะ allow port สำหรับที่จะใช้เท่านั้น
  • 4. ควรกำหนด Network policy ให้ Pod สามารถคุยกันได้เฉพาะ ที่จะใช้เท่านั้น
  • 5. set policy agent pod ให้ Deployment deploy only namespace ที่ pod สามารถ deploy ได้เท่านั้น
  • 6. service account pod ควร สิทธิ์ เฉพาะที่ pod นั้นใช้เท่านั้น
  • 7. Image ควรใช้ Private Registry
@PanupongDeve
PanupongDeve / .gitconfig
Created August 22, 2020 12:03 — forked from NantipatSoftEn/.gitconfig
git commit template and short word
[alias]
st = status
ci = commit
br = branch
co = checkout
p = push origin
cap = "!f() { git commit -m \"$@\"; }; f"
int = "!f() { git cap \"🎉 initial commit $1 $2\"; }; f"
addfeature ="!f() { git cap \"🚀 implementing a new feature $1 $2\"; }; f";
con = "!f() { git cap \"🚧 work in progress $1 $2\"; }; f";
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"autoscaling:DescribeAutoScalingGroups",
"autoscaling:DescribeAutoScalingInstances",
"autoscaling:DescribeLaunchConfigurations",
"autoscaling:DescribeTags",
"autoscaling:SetDesiredCapacity",
apiVersion: v1
kind: ServiceAccount
metadata:
name: eks-dashboard-admin
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1beta1
trigger:
- 'ci-dev'
pool:
name: 'lab-ci-test'
demands:
- agent.name -equals agent-ci-dev
steps:
- script: 'docker-compose down'
var defaultPrompt;
if ('serviceWorker' in navigator) {
navigator.serviceWorker
.register('/sw.js')
.then(() => {
console.log('sw registed!');
})
.catch((err) => {
console.log(err);
});
const STATIC_CHACHES_NAME = 'static-v3';
const DYNAMIC_CHACHES_NAME = 'dynamic';
// event เมื่อ ติดตั้ง service worker
self.addEventListener('install', (event) => {
// console.log('[Service Worker] Installing Service Worker ...', event);
// add cache api
event.waitUntil(
caches.open(STATIC_CHACHES_NAME)
@PanupongDeve
PanupongDeve / download-file.js
Created March 21, 2019 02:26 — forked from javilobo8/download-file.js
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);