Skip to content

Instantly share code, notes, and snippets.

View nunomazer's full-sized avatar
🎯
Coding ... allways

Ademir Mazer Jr [ Nuno ] nunomazer

🎯
Coding ... allways
View GitHub Profile
@nunomazer
nunomazer / NamedParameterStatement.java
Last active October 21, 2020 14:50
Class that prepare a statement with named parameters.
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Timestamp;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@nunomazer
nunomazer / find_sintaxe_error.sh
Created June 8, 2014 23:38
Find sintaxe errors in php files from command line
find . \( -name "*.php" -o -name "*.phtml" \) -exec php -l {} \;
@nunomazer
nunomazer / run.conf
Created January 29, 2014 18:44
Alter config for CrashplanDesktop do not crash on Linux Mint
/**
/* Add the option below in GUI_JAVA_OPTS quotes,
/* -Dorg.eclipse.swt.browser.DefaultType=mozilla
/* like the sample
**/
SRV_JAVA_OPTS="-Dfile.encoding=UTF-8 -Dapp=CrashPlanService -DappBaseName=CrashPlan -Xms20m -Xmx512m -Djava.net.preferIPv4Stack=true -Dsun.net.inetaddr.ttl=300 -Dnetworkaddress.cache.ttl=300 -Dsun.net.inetaddr.negative.ttl=0 -Dnetworkaddress.cache.negative.ttl=0 -Dc42.native.md5.enabled=false"
GUI_JAVA_OPTS="-Dfile.encoding=UTF-8 -Dapp=CrashPlanDesktop -DappBaseName=CrashPlan -Xms20m -Xmx512m -Djava.net.preferIPv4Stack=true -Dsun.net.inetaddr.ttl=300 -Dnetworkaddress.cache.ttl=300 -Dsun.net.inetaddr.negative.ttl=0 -Dnetworkaddress.cache.negative.ttl=0 -Dc42.native.md5.enabled=false -Dorg.eclipse.swt.browser.DefaultType=mozilla"
<?php
interface SubscriberInterface {
public static function getSubscribedEvents();
}
class BlogSubscriber implements SubscriberInterface {
public static function getSubscribedEvents() {
return array(
'blog_update' => 'Listener'
);
@nunomazer
nunomazer / jsr-php-client.php
Last active January 17, 2020 09:27
Using PHP client for Jaspersoft Server
<?php
/* Initializing client */
require_once "client/JasperClient.php";
$client = new Jasper\JasperClient('localhost', // Hostname
8080, // Port
'jasperadmin', // Username
'jasperadmin', // Password
@nunomazer
nunomazer / max_file_upload.php
Created May 8, 2013 23:04
Function to get the max file upload allowed by php.ini configuration
<?php
function getMaxFileUpload() {
$max_upload = (int)(ini_get('upload_max_filesize'));
$max_post = (int)(ini_get('post_max_size'));
$memory_limit = (int)(ini_get('memory_limit'));
$upload_mb = min($max_upload, $max_post, $memory_limit);
}
<?php
define('DB_DRIVER', 'mysql');
define('DB_HOST', 'localhost');
define('DB_USER', 'root');
define('DB_PWD', 'minhasenha');
define('DB_DATABASE', 'meubancodedados');
try {
$pdo = new PDO(DB_DRIVER.':host='.DB_HOST.';dbname='.DB_DATABASE, DB_USER, DB_PWD);
@nunomazer
nunomazer / linux-config-after-install.sh
Last active December 15, 2015 04:09
Customizations after installing Ubuntu / Mint
#!/bin/sh
cd ~/Downloads
# adding getdeb repository
#sudo add-apt-repository 'deb http://archive.getdeb.net/ubuntu precise-getdeb apps'
#sudo wget -q -O- http://archive.getdeb.net/getdeb-archive.key | sudo apt-key add -
# adding classic menu repository
#sudo add-apt-repository ppa:diesch/testing
@nunomazer
nunomazer / gist:5110145
Created March 7, 2013 17:52
Removing OpenJdk and installing Oracle-Sun Jdk 7
sudo apt-get purge openjdk*
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
@nunomazer
nunomazer / conky
Created October 31, 2012 18:16
Conky
# Generated by Conky GUI
# Check http://conkygui.sourceforge.net/
# For the latest version of Conky GUI
#24-Nov-10 02:38:22 PM
#author: conky
# Conky
background yes
no_buffers yes