Skip to content

Instantly share code, notes, and snippets.

View antoniopresto's full-sized avatar

Antonio Silva antoniopresto

View GitHub Profile
# Will show all the driver packages which apply to your current system. You can then
# sudo ubuntu-drivers list
# to install all the packages you need, or you can do:
sudo ubuntu-drivers autoinstall
# to show you which devices need drivers, and their corresponding package names.
# sudo ubuntu-drivers devices
@antoniopresto
antoniopresto / Form.js
Last active November 30, 2019 14:04
Antd Masked Input
import { Form } from 'antd'
import { FormInput } from './antd-masked-input'
export default () => (
<Form>
<FormInput
form={this.props.form} // antd form
mask={'111.111.111-11'}
placeholder=""
label={''}
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import styled from 'styled-components'
const ${NAME}Wrapper = styled.div``
class ${NAME}Component extends Component {
static propTypes = {
children: PropTypes.any,
}
@antoniopresto
antoniopresto / banco_codigo.json
Last active March 25, 2025 06:43
JSON bancos do brasil com código
[
{
"value": "001",
"label": "Banco do Brasil S.A."
},
{
"value": "003",
"label": "Banco da Amazônia S.A."
},
{
@antoniopresto
antoniopresto / nginxproxy.md
Created March 21, 2018 13:38 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@antoniopresto
antoniopresto / README.md
Created March 21, 2018 13:09 — forked from jimothyGator/README.md
Nginx configuration for Mac OS X with Homebrew, using sites-enabled directory.
mkdir -p /usr/local/etc/nginx/sites-{enabled,available}
cd /usr/local/etc/nginx/sites-enabled
ln -s ../sites-available/default.conf
ln -s ../sites-available/default-ssl.conf

File locations:

  • nginx.conf to /usr/local/etc/nginx/
  • default.conf and default-ssl.conf to /usr/local/etc/nginx/sites-available
  • homebrew.mxcl.nginx.plist to /Library/LaunchDaemons/
@antoniopresto
antoniopresto / mascara-celular.js
Created March 20, 2018 21:27
mascara de celular
const value = num
.replace(/[^\d]/gm, '')
.replace(/^(\d\d)([^ ]+)$/, '($1) $2')
.replace(/(\(\d\d\)) (\d{5})(\d)$/, '$1 $2-$3')
.replace(/(\(\d\d\)) (\d{4})(\d{1,5})$/, '$1 $2-$3')
.replace(/(\(\d\d\)) (\d{4})-(\d)(\d{4})$/, '$1 $2$3-$4')
.replace(/(\(\d\d\)) (\d{5})(\d{4})(.*)/, '$1 $2-$3')
@antoniopresto
antoniopresto / resolve.md
Created March 12, 2018 15:32
Git - Resolve multiple conflicts

grep -lr '<<<<<<<' . | xargs git checkout --ours OR grep -lr '<<<<<<<' . | xargs git checkout --theirs

@antoniopresto
antoniopresto / myip.sh
Created March 1, 2018 11:12
local machine ip
ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'
@antoniopresto
antoniopresto / kp
Last active May 25, 2021 12:14
Kill process
# kp 3000 node # kill if node is running on port 3000
# kp 3000 # kill process running on port 3000
PORT=$1;
MATCH=$2;
if [ -n "$MATCH" ]; then
kill -9 `lsof -i :$PORT | awk -v MATCH=$2 '$0 ~ MATCH{ print $2; }'`
exit;
fi;