Skip to content

Instantly share code, notes, and snippets.

View juanpablocs's full-sized avatar
💭
👨‍💻 Coding..

Juan pablo juanpablocs

💭
👨‍💻 Coding..
View GitHub Profile
@juanpablocs
juanpablocs / google_cookie.md
Created October 4, 2020 00:50
Google auth cookie with curl
@juanpablocs
juanpablocs / ssl_client_cert_if.conf
Last active September 14, 2020 04:35 — forked from onnimonni/ssl_client_cert_if.conf
How to regex from nginx variable with map directive
##
# I wanted to use same ssl client certificate CA in nginx for multple client certs
# but restrict the users outside our organisation accessing everything.
# Because I can decide what to put into the emailAddress I can force verify everything and only pass the proper users.
##
##
# This way you can restrict users only with email addresses from @koodimonni.fi
# Put this into http context in nginx configs
##
@juanpablocs
juanpablocs / reduce.md
Last active September 9, 2020 05:19
Reduce js basic examples..

Simple

[1,2,3,4].reduce( (acc,current) => acc+current , 0); // result => 10

Object sum

[
 {item: 10},
@juanpablocs
juanpablocs / cors_proxy_pass.md
Last active May 19, 2020 17:35
How to configure nginx site with cors and proxy_pass

Nginx config

server {
    listen 80;
    server_name site.dev;
    add_header 'Access-Control-Allow-Credentials' 'true';
    location /  {
       proxy_pass http://127.0.0.1:3001/;
 }
@juanpablocs
juanpablocs / gdrive.php
Created March 31, 2020 03:45
Google drive php 2020
<?php
/*
https://redirector.googlevideo.com/videoplayback?
id=62705830c2bbd616&
itag=22&
source=youtube&
requiressl=yes&
ei=G5-CXpqzGIn6Wa3MvvAB&
susc=ytcp&
@juanpablocs
juanpablocs / curl.md
Last active January 8, 2019 16:54
Curl commands utils for devops

1 to 10 requests and get only http code

curl -s -o /dev/null -I -w "Http Code: %{http_code}\n" "http://mysite.com?[1-10]"

10 request simultaneous and get only http code

seq 1 10 | xargs -I % -n 1 -P 10 curl -s -o /dev/null -I -w "http: %{http_code}\n" "http://mysite.com"
@juanpablocs
juanpablocs / docker_nodejs.md
Last active October 15, 2018 15:34
Docker nodejs image and container with docker-compose.yml

package.json

{
  "name": "orbis",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "start": "node ./index.js"
 },
@juanpablocs
juanpablocs / php_multi_curl.md
Created August 23, 2018 15:17
Fast multiple request with curl
<?php

class MultiRequest 
{
    /**
     * 
     * @param array $endpoints
     * <array>
     *   <identifier> identificador usado para devolver el response
@juanpablocs
juanpablocs / ansible.md
Last active June 3, 2018 18:15
create first connection with ansible and ubuntu

Install Ansible

add repository

sudo apt-add-repository ppa:ansible/ansible
sudo apt-get update
@juanpablocs
juanpablocs / sunat.md
Last active September 4, 2023 20:10
Ver RUC de la Sunat con node.js sin captcha. Simple y rápido.

Ruc Sunat

Obtener resultados sin necesidad de captcha ni ocr. Simple código

Instalar paquetes

npm init -y
npm i request cheerio --save

Run