Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Focusing

Candido Sales Gomes candidosales

🏠
Focusing
View GitHub Profile
@candidosales
candidosales / batch_parellel_processing.go
Last active Aug 17, 2020
Use batch and coroutines to parallelize processing
View batch_parellel_processing.go
const (
MaxBulkDelete = 1000
MaxBatchSize = 25
)
func (s service) BulkDelete(ctx context.Context, businessMetrics []*vanalytics_v1.DeleteBusinessMetricRequest) (*vanalytics_v1.DeleteMultiBusinessMetricsResponse, error) {
response := &vanalytics_v1.DeleteMultiBusinessMetricsResponse{}
if len(businessMetrics) > MaxBulkDelete {
View install-wp-cli.md
apt install php7.2-mysql php7.2-dom php7.2-curl
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
php wp-cli.phar --info
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
wp --info

References

@candidosales
candidosales / solve-digital-ocean.md
Created Jul 4, 2019
Solve SHH Droplet Digital Ocean
View solve-digital-ocean.md

I had a machine crash, and needed to setup another one with SSH access. I got the console login ok, but no way to paste my public key there. Just spent a whole day trying to find a way to do this.

My solution, finally was to put the public key on a public dropbox folder, then in the console, use:

curl 'https://dl.dropbox.....' > temp1
cat temp1 >> .ssh/authorized_keys
@candidosales
candidosales / README.md
Last active Apr 3, 2019
Tutorial to crawler with scrapy
View README.md
@candidosales
candidosales / .gitlab-ci.yaml
Last active Jun 20, 2018
Gitlab CI + App Engine
View .gitlab-ci.yaml
image: google/cloud-sdk:latest
stages:
- deploy
####################################################################################################
# DEPLOY
#
.deploy_template: &deploy_template_def
stage: deploy
@candidosales
candidosales / response.kt
Last active Apr 26, 2018
Como tratar os erros
View response.kt
// {
// "id": 4,
// "name": "Nikola Tesla",
// "branch": "0001",
// "branchVerificationDigit": "string",
// "account": "1256720",
// "accountVerificationDigit": 3,
// "phone": "11 95555-5555",
// "email": "nikola@tesla.com",
// "apiMetadata": {
View ProductList.js
export default function productList(products) {
const element = document.getElementById('product-list');
// map of products
let productItem = products.map(product => `
<div class="product-item">
<h1 class="product-title">${product.productVariants[0].title}</h1>
<img class="product-image" src="${product.productVariants[0].imageUrl}" alt="${product.productVariants[0].title}">
<p class="product-price">${product.productVariants[0].price}</p>
View custom-material.module.ts
import { NgModule } from '@angular/core';
import {
MatButtonModule,
MatSnackBarModule,
MatCardModule,
MatInputModule,
MatCheckboxModule,
MatIconModule,
MatSidenavModule,
MatSelectModule,
View gist:e4e18009781dc811aba5fe1d0018eea5
Verifying that "candidosales.id" is my Blockstack ID. https://onename.com/candidosales
@candidosales
candidosales / nginx.conf
Created Apr 30, 2017
NGINX SSL Docker + Website static + Performance + Security Raw
View nginx.conf
user nginx;
# PERFORMANCE
# https://gist.github.com/denji/8359866
# you must set worker processes based on your CPU cores, nginx does not benefit from setting more than that
worker_processes auto; #some last versions calculate it automatically
# number of file descriptors used for nginx
# the limit for the maximum FDs on the server is usually set by the OS.
# if you don't set FD's then OS settings will be used which is by default 2000
worker_rlimit_nofile 100000;