Skip to content

Instantly share code, notes, and snippets.

View pauloremoli's full-sized avatar

Paulo Remoli pauloremoli

View GitHub Profile
@pauloremoli
pauloremoli / useStickyState.js
Last active February 23, 2022 07:37
Sticky react state - Persist state in local storage
// https://www.joshwcomeau.com/react/persisting-react-state-in-localstorage/
function useStickyState(defaultValue, key) {
const [value, setValue] = React.useState(() => {
const stickyValue = window.localStorage.getItem(key);
return stickyValue !== null
? JSON.parse(stickyValue)
: defaultValue;
});
React.useEffect(() => {
@pauloremoli
pauloremoli / FadeIn.js
Last active February 23, 2022 07:37
FadeIn component
// https://www.joshwcomeau.com/snippets/react-components/fade-in/
// FadeIn.js
import React from 'react';
import styled, { keyframes } from 'styled-components';
const fadeIn = keyframes`
from {
opacity: 0;
}
to {
#!/bin/bash
#
# Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
#
# This file is part of the TerraLib - a Framework for building GIS enabled applications.
#
# TerraLib is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
@pauloremoli
pauloremoli / describe.py
Created November 9, 2015 13:09
Describe classes, methods and functions in a python module.
#!/usr/bin/env python
# Describe classes, methods and functions in a module.
# Works with user-defined modules, all Python library
# modules, including built-in modules.
import inspect
import os, sys
INDENT=0

#Comandos do Git


Push branch local para o origin

git push -u origin branch_name


@pauloremoli
pauloremoli / create_user_postgres.md
Last active February 26, 2025 16:18
Create postgresql user Mac OS X

Create postgresql user Mac OS X

After installing the postgres app: http://postgresapp.com/

It will create a database user with the current username, to create another user for example 'postgres':

$ createuser postgres -s

Open psql with the created user using -U

$ psql postgres -U postgres

#Configuration of Xcode for C++

Using the ALL_BUILD configuration

Edit the scheme: Product -> Scheme -> Edit Scheme

Set the environment variables: Run -> Arguments -> Enviroment Variables

Configure the path to all required libraries

# coding: utf-8
import click
import psycopg2
from collections import defaultdict
@click.command()
@click.option('--host', default='localhost')
@click.option('--port', default=5432)
@click.option('--username', default='postgres')
import json
import os
import sys
import subprocess
# Function to configure the project using
def configure_command(source_dir, output_dir, params):
if ( os.path.exists(output_dir) == False):
os.mkdir(output_dir)
print ('Created output dir...')