Skip to content

Instantly share code, notes, and snippets.

Gonzalo Andres VR gnzandrs

Block or report user

Report or block gnzandrs

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gnzandrs
gnzandrs / medium-program.cs
Created Apr 21, 2019
ASP.NET core default program.cs
View medium-program.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
@gnzandrs
gnzandrs / medium-usuariocontroller.cs
Created Apr 20, 2019
dotnet core user controller crud methods
View medium-usuariocontroller.cs
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using DotNetApi.Models;
namespace DotNetApi.Controllers
{
[Route("api/[controller]")]
@gnzandrs
gnzandrs / medium-usuario.cs
Created Apr 18, 2019
dotnet core user model class to EntityFramework
View medium-usuario.cs
using System.ComponentModel.DataAnnotations;
namespace DotNetApi.Models
{
public class Usuario
{
[Key]
public long IdUsuario { get; set; }
public string Nombres { get; set; }
public string ApellidoPaterno { get; set; }
@gnzandrs
gnzandrs / medium-startup.cs
Created Apr 18, 2019
Startup file example for a defaultconnection added in services.
View medium-startup.cs
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using DotNetApi.Models;
namespace DotNetApi
{
@gnzandrs
gnzandrs / medium-dotnet-context.cs
Created Apr 18, 2019
data base context class for dotnet core
View medium-dotnet-context.cs
using Microsoft.EntityFrameworkCore;
namespace DotNetApi.Models
{
public class dbContext : DbContext
{
public dbContext(DbContextOptions<dbContext> options)
: base(options)
{
}
@gnzandrs
gnzandrs / medium-dotnetcore-appsettings.json
Created Apr 18, 2019
dotnet core development connectionstring example
View medium-dotnetcore-appsettings.json
{
"Logging": {
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
@gnzandrs
gnzandrs / medium-serverless-basic-config.yml
Created Apr 1, 2019
serverless basic configuration file example for medium
View medium-serverless-basic-config.yml
service: hola-mundo
plugins:
- serverless-offline
provider:
name: aws
runtime: nodejs6.10
stage: dev
region: us-west-2
@gnzandrs
gnzandrs / mapbox-render-node-react.jsx
Created Feb 10, 2019
mapbox rendering with react and node client-side for medium
View mapbox-render-node-react.jsx
import React from 'react'
let mapboxgl;
if (__CLIENT__) {
mapboxgl = require('mapbox-gl')
mapboxgl.accessToken = 'yourkeyhere';
}
class Map extends React.Component {
constructor() {
@gnzandrs
gnzandrs / nginx-tuning.md
Created Jan 22, 2019 — forked from denji/nginx-tuning.md
NGINX tuning for best performance
View nginx-tuning.md

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@gnzandrs
gnzandrs / script.sh
Created Jan 2, 2019 — forked from tonylukasavage/script.sh
Move all uncommitted changes to a new branch and revert the existing branch to HEAD. "master" has uncommitted changes. You decided you'd rather make those changes in "dev_branch". Here's how to move those uncommitted changes to "dev_branch" and then revert "master" to its last commit.
View script.sh
# get into the master branch
git checkout master
# create a new branch for the changes and check it out
git checkout -b dev_branch
# stash the changes until we revert master
git stash
# go back to master
You can’t perform that action at this time.