Skip to content

Instantly share code, notes, and snippets.

@sergioska
sergioska / putFormRequest.json
Last active January 15, 2021 09:24
Serverless local invoke with query string parameters
# products/{product}/user/{id}
# invoke with npx
# sls invoke local -s dev -f put-json-form-with-id -p ~/putFormRequest.json
{
"body": {
},
"pathParameters": {
"id": "1",
"product": ""
window.onload = () => {
'use strict';
var times = 0;
var output = '';
var interval = setInterval(() => {
times += 1;
if (times === 5) {
clearInterval(interval);
scrollTo(0, 0);
var test = document.querySelectorAll('a[uid]');
@sergioska
sergioska / k8s-pv-www-claim.yaml
Last active January 15, 2021 09:28
[k8s] persistent volume claim
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pv-www-claim
spec:
storageClassName: standard
accessModes:
- ReadWriteOnce
resources:
requests:
@sergioska
sergioska / k8s-configMap.yaml
Last active May 8, 2020 15:07
[k8s] configMap for nginx configuration about kubernetes web applicaiont deploy
kind: ConfigMap
apiVersion: v1
metadata:
name: nginx-config
data:
default.conf: |
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
@sergioska
sergioska / k8s-nginx-php-fpm-deployment.yaml
Last active April 3, 2024 09:31
[k8s] deployment nginx/php-fpm
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: app
name: web
namespace: default
spec:
replicas: 1
selector:
@sergioska
sergioska / Dockerfile
Last active January 15, 2021 09:29
php-fpm docker image
FROM php:7.4-fpm
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libpng-dev \
libzip-dev \
libicu-dev \
libzip4 \
&& pecl install xdebug \
&& docker-php-ext-install opcache \
@sergioska
sergioska / swapon.sh
Created October 21, 2019 08:18
Enable swap allocation
# swap space allocation
sudo fallocate -l 1G /var/swap.1
# or use following command that agnostic about distro
#sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
sudo chmod 600 /var/swap.1
sudo /sbin/mkswap /var/swap.1
sudo /sbin/swapon /var/swap.1
# check if swap is up in the right way
sudo swapon --show
@sergioska
sergioska / cors.conf
Created September 13, 2018 14:07
CORS Apache Configuration
<VirtualHost *:80>
# add this in apache virtualhost configuration file to avoid CORS problem enabling request from multiple origin
# (optionally change LocationMatch path)
<LocationMatch "/">
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
Header set Access-Control-Max-Age "1000"
Header set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token"
</LocationMatch>
</VirtualHost>
@sergioska
sergioska / ssl.conf
Last active June 28, 2018 09:02
https apache2
<VirtualHost *:443>
SSLEngine on
SSLCertificateFile "/etc/ssl/ssl_certificate.crt"
SSLCertificateKeyFile "/etc/ssl/ssl_certificate.key"
SSLCACertificateFile "/etc/ssl/ssl_certificate.ca-bundle"
ServerAdmin admin@mysite.com
DocumentRoot /var/www/html/mysite
ServerName www.mysite.com
@sergioska
sergioska / versions.sh
Created May 10, 2018 08:14
VERSIONS AWS
#!/bin/bash
EMI=/etc/issue
NODE=`which node`
NPM=`which npm`
APACHE=httpd
echo AMI VERSION: `cat $EMI | grep -Eo [0-9\.]+`
echo NODE VERSION: `$NODE -v`
echo NPM VERSION: `$NPM -v`