Skip to content

Instantly share code, notes, and snippets.

Avatar
😀

Felipe Lima felipebizz

😀
View GitHub Profile
@felipebizz
felipebizz / addSessionVariable.xml
Last active Aug 29, 2015
[Mule] Add sessionVariable inside Groovy
View addSessionVariable.xml
<flow name="get:/user/{username}:api-config">
<set-session-variable variableName="username" value="#[flowVars['username']]" doc:name="Session Variable"/>
<set-payload value="#[payload]" doc:name="payload"/>
<scripting:component doc:name="Groovy">
<scripting:script engine="Groovy"><![CDATA[
def root = [:];
root.user = sessionVars['username']
def jsonContent = new groovy.json.JsonBuilder(root);
return jsonContent.toPrettyString();
]]></scripting:script>
@felipebizz
felipebizz / createJson.JSON
Created Jun 23, 2015
Create Json With Groovy
View createJson.JSON
def content = [:];
content.expand = 'schema,names';
content.startAt = 0;
content.maxResults = 500
content.total= 7
content.issues =[:];
content.issues = list
def jsonContent = new groovy.json.JsonBuilder(content);
println 'JSON : ' +jsonContent.toString()
@felipebizz
felipebizz / wgt.bash
Created Jun 23, 2015
WGET with Authorization
View wgt.bash
wget http://user:senha@webdav.arizona.com.br/caminhodoarquivo
@felipebizz
felipebizz / mysqldump.bash
Last active Aug 29, 2015
How To Backup MySQL Databases on an Ubuntu
View mysqldump.bash
#create a Dump
mysqldump -u username -p database_to_backup > backup_name.sql
#Restoring
mysql -u username -p
CREATE DATABASE database_name;
exit
@felipebizz
felipebizz / UpdateCmis.java
Last active Aug 29, 2015
Update Properties Cmis
View UpdateCmis.java
package br.com.arizona.visto.system.dam.repository.cmis;
import org.apache.chemistry.opencmis.client.api.*;
import org.apache.chemistry.opencmis.client.runtime.SessionFactoryImpl;
import org.apache.chemistry.opencmis.commons.SessionParameter;
import org.apache.chemistry.opencmis.commons.data.PropertyData;
import org.apache.chemistry.opencmis.commons.enums.BindingType;
import java.util.*;
@felipebizz
felipebizz / timezone.sh
Created Apr 16, 2015
Set TimeZone in Ubuntu
View timezone.sh
vim /etc/timezone
#Altere para America/Sao_Paulo
#Agora para atualizar utilizando a variável TZ faça:
export TZ=America/Sao_Paulo
#Vamos verificar com:
#date
@felipebizz
felipebizz / encode.py
Created Apr 9, 2015
Econde image for base64 in python
View encode.py
data_uri = open("/home/foto.png", "rb").read().encode("base64").replace("\n", "")
# HTML Image Element
img_tag = '<img alt="" src="data:image/png;base64,{0}">'.format(data_uri)
print img_tag
# CSS Background Image
css = 'background-image: url(data:image/png;base64,{0});'.format(data_uri)
print css
View download_cmis.py
# pip install cmislib
import os
import urllib
from cmislib import CmisClient
def download_thumb_file(cmis_object_id, cmis_repo, cmis_url, cmis_user, cmis_passwd, download_base_folder):
client = CmisClient(cmis_url, cmis_user, cmis_passwd)
repo = client.getRepository(cmis_repo)
cmis_object = repo.getObject(cmis_object_id)
@felipebizz
felipebizz / erase_kernel
Created Apr 7, 2015
Erase Kernel Old Versions
View erase_kernel
##############################################################
#### Apagar versoes antigas de Kernel ####
##############################################################
#ver versoes anteriores do linux instaladas
dpkg --get-selections | grep linux-image
#APAGAR(Sempre deixar duas)
View utils_ubuntu.sh
#SYSTEM LOAD INDICATOR
sudo add-apt-repository ppa:indicator-multiload/stable-daily
sudo apt-get update
sudo apt-get install indicator-multiload
#Dentro do arquivo /home/felipe/.bashrc
#variavel do terminal
export PS1="\[\033[38m\]\u\[\033[32m\] \w \[\033[31m\]\`git \\
branch 2>/dev/null | grep \"^\*\" | \\