Skip to content

Instantly share code, notes, and snippets.

View PedroBern's full-sized avatar

pedrobern PedroBern

View GitHub Profile
@PedroBern
PedroBern / trabalho_topografia.py
Created March 24, 2019 14:12
Cálculo da área de polígono desenhado por azimutes e distancia
import turtle as tu
import numpy as np
screen = tu.Screen()
points = [[10,240],[269,330],[170,410],[110,230],[0,260]]
t = tu.Turtle()
t.speed('fastest')
c = tu.Turtle()
@PedroBern
PedroBern / keymap.cson
Created March 24, 2019 14:52
My atom keymap for mac
# Your keymap
#
# Atom keymaps work similarly to style sheets. Just as style sheets use
# selectors to apply styles to elements, Atom keymaps use selectors to associate
# keystrokes with events in specific contexts. Unlike style sheets however,
# each selector can only be declared once.
#
# You can create a new keybinding in this file by typing "key" and then hitting
# tab.
#
import numpy as np
matrix01 = np.matrix([
[3, -0.1, -0.2],
[0.1, 7, -0.3],
[0.3, -0.2, 10],
])
solution01 = np.matrix([
[7.85, -19.3, 71.4]
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib.ticker import LinearLocator, FormatStrFormatter
# Dados do problema
gama = 19
m = 0.5
k = 0.5
import numpy as np
from collections import namedtuple
import matplotlib.pyplot as plt
# Dados do problema:
gama_a = 20
gama_n = 23
h = 12
sup_base = 10
from trianglesolver import solve
import numpy as np
# a, b, c são os lados dos triangulos
# A, B, C são os angulos dos triangulos, sempre opostos ao lado de mesma letra
a, b, c, A, B, C = solve(a=11.4, B=np.deg2rad(60), C=np.deg2rad(110))
print('Distancia margem do rio (metros):', b)
a, b, c, A, B, C = solve(a=46.4, b=3.9-0.4, C=np.pi/2)
@PedroBern
PedroBern / fundacoes.py
Last active September 14, 2019 20:47
Fundacoes
import math
import numpy as np
import scipy.optimize as optimize
import matplotlib.pyplot as plt
import sys
from tabulate import tabulate
def _round(n):
if n - math.floor(n) < 0.5:
@PedroBern
PedroBern / react-no-context-rerender.md
Last active October 22, 2019 16:46
Avoid react context rerender

There are some ways to avoid re-renders, also make your state management "redux-like". I will show you how I've been doing, it far from being a redux, because redux offer so many functionalities that aren't so trivial to implement, like the ability to dispatch actions to any reducer from any actions or the combineReducers and so many others.

Create your reducer

export const reducer = (state, action) => {
  ...
};

Create your ContextProvider component

@PedroBern
PedroBern / config.cson
Last active December 20, 2019 19:30
My atom config files
"*":
core:
telemetryConsent: "no"
themes: [
"one-light-ui"
"one-light-syntax"
]
diagrams:
previewWidth: 536
editor:
---
title: "Concreto Protendido e Pré-Moldado - Trabalho A1"
author: "Pedro Bernardino Alves Moreira - 20142104155"
abstract: "O trabalho foi calculado em linguágem R, esse relatório foi gerado automáticamente a partir dos dados de entrada. Um link para o código utilizado é disponibilizado ao final do trabalho."
date: "31/03/2020"
output: pdf_document
header-includes:
- \renewcommand{\abstractname}{Introdução}
---