Skip to content

Instantly share code, notes, and snippets.

View leonardocregis's full-sized avatar

Leonardo leonardocregis

  • Rio de Janeiro
View GitHub Profile
@leonardocregis
leonardocregis / javscript - reactjs - templates
Created December 26, 2018 00:35
templates for react to just startup
#creating as a function
function MyFunc(props) {
return (
<button className="square" onClick={props.onClick}>
{props.value}
</button>
);
}
export default MyFunc;
@leonardocregis
leonardocregis / javascript - react - using create-react-app
Created December 25, 2018 23:30
Some most used commands with create-react-app
#installing
npm i -g create-react-app
#using
create-react-app <projet-name>
@leonardocregis
leonardocregis / npm - most used commands
Created December 7, 2018 13:16
Most usefull commands list
#list all global libs
npm list -g
@leonardocregis
leonardocregis / script-to-send-mail
Created December 3, 2018 10:51
SMTP - sending a email
Telnet to your smtp server like
telnet smtp.mydomain.com 25
Syntax :
telnet {smtp_domain_name} {port_number}
And copy and paste the below
helo your_domain.com
mail from:<test@your_domain.com>
@leonardocregis
leonardocregis / linux - permissions
Created October 31, 2018 13:53
Gist to deal with permissions in linux
#put a file availiable to everybody
chmode 777
@leonardocregis
leonardocregis / java - reflection
Created October 22, 2018 19:45
Shortcut template for using a reflect to deal with anotations
package com.sicpa.gssd.clsii.server.dms.customization.feature;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Arrays;
import javax.inject.Named;
import org.junit.Test;
import com.sicpa.gssd.clsii.server.dms.customization.feature.das.manager.ClsiiDigitalActivationManagerImpl;
#listing locally
npm ls
#listing globally, only the first level
npm ls -g --depth=0
@leonardocregis
leonardocregis / nosql - redis - anotations
Created August 2, 2018 11:55
General anotations for Redis
Basic concepts:
-key-value store
-NoSql
-Values with expiration/ good for security
Commands (=> indicates the return expected)
SET server:name "fido"
- store based into a key
SETNX
@leonardocregis
leonardocregis / curl - proxy sample
Created August 1, 2018 11:58
A curl using proxy sample
curl url
--proxy url:port
--proxy-user username:"password"
remarks
a password with ! symbol , needs a scape like "\!"
@leonardocregis
leonardocregis / curl - oauth sample
Created August 1, 2018 11:56
A sample of curl to call a url with some headers and form data
curl http://localhost:3000/oauth/token
-d "grant_type=password"
-d "username=pedroetb"
-d "password=password"
-H "Authorization: Basic YXBwbGljYXRpb246c2VjcmV0"
-H "Content-Type: application/x-www-form-urlencoded"
remarks
-H: defines a header
-d: defines a form data