Skip to content

Instantly share code, notes, and snippets.

View kouzouigh's full-sized avatar

Ouzouigh Kamel kouzouigh

View GitHub Profile
@kouzouigh
kouzouigh / PostgreSQL_index_naming.rst
Created September 19, 2019 13:40 — forked from popravich/PostgreSQL_index_naming.rst
PostgreSQL index naming convention to remember

The standard names for indexes in PostgreSQL are:

{tablename}_{columnname(s)}_{suffix}

where the suffix is one of the following:

  • pkey for a Primary Key constraint;
  • key for a Unique constraint;
  • excl for an Exclusion constraint;
  • idx for any other kind of index;
@kouzouigh
kouzouigh / groovy_multipart_form_data.groovy
Created July 1, 2019 06:55
Groovy HTTPBuilder with multipart/form-data
import groovy.json.JsonSlurper
import groovyx.net.http.HTTPBuilder
import org.apache.http.entity.mime.MultipartEntityBuilder
import static groovyx.net.http.Method.POST
def url = '<URL>'
def token = '<TOKEN>'
def document = "<PATH_TO_FILE>"
def printErr = System.err.&println
@kouzouigh
kouzouigh / notifySlack.groovy
Created May 14, 2019 08:27 — forked from dschaaff/notifySlack.groovy
jenkins pipeline library for slack notifications with nice formatting
#!/usr/bin/env groovy
/**
* notify slack and set message based on build status
*/
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import hudson.tasks.test.AbstractTestResultAction;
import hudson.model.Actionable;
@kouzouigh
kouzouigh / Jenkinsfile
Created September 14, 2018 23:28 — forked from merikan/Jenkinsfile
Some Jenkinsfile examples
Some Jenkinsfile examples
@kouzouigh
kouzouigh / openssl-cheat.sh
Created July 23, 2018 09:52 — forked from alvarow/openssl-cheat.sh
OpenSSL and Keytool cheat sheet
# Generate a new key
openssl genrsa -out server.key 2048
# Generate a new CSR
openssl req -sha256 -new -key server.key -out server.csr
# Check certificate against CA
openssl verify -verbose -CApath ./CA/ -CAfile ./CA/cacert.pem cert.pem
# Self Signed
@kouzouigh
kouzouigh / get_keycloak_access_token.sh
Created June 16, 2018 23:34 — forked from adixchen/get_keycloak_access_token.sh
Get Keycloak access token via curl and pretty print it with python
curl \
-d 'client_id=YOUR_KEYCLOAK_CLIENT' \
-d 'username=YOUR_USERNAME' \
-d 'password=YOUR_PASSWORD' \
-d 'grant_type=password' \
'https://YOUR_KEYCLOAK_SERVER_HOST/auth/realms/YOUR_REALM/protocol/openid-connect/token' \
| python -m json.tool
@kouzouigh
kouzouigh / ParentChildState.js
Created June 3, 2018 00:00
React Parent Child sharing state
class Button extends React.Component {
handleClick = () => {
this.props.onClickFunction(this.props.incrementValue)
}
render() {
return (
<button onClick={this.handleClick}>+{this.props.incrementValue}</button>
)
}
@kouzouigh
kouzouigh / Button.jsx
Last active June 3, 2018 00:01
Simple React Button Component with increment Event Click Handler
class Button extends React.Component {
state = { counter: 0 };
handleClick = () => {
this.setState(prevState => {
return {
counter: prevState.counter + 1
}
})
@kouzouigh
kouzouigh / XMLSignature.java
Created April 16, 2018 07:11 — forked from jsbsantos/XMLSignature.java
XMLSignature impl
package ccf.comum.util;
import java.io.BufferedWriter;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
@kouzouigh
kouzouigh / setenv.sh
Created January 30, 2018 15:52 — forked from patmandenver/setenv.sh
Tomcat8 setenv.sh
#
# Cutom Environment Variables for Tomcat
#
############################################
export JAVA_HOME=/usr/lib/jvm/java-7-oracle/jre
export PATH=${JAVA_HOME}/bin:${PATH}
############################################
#
# JAVA_OPTS