Skip to content

Instantly share code, notes, and snippets.

View ssisaias's full-sized avatar
👨‍💻
:)

Isaias S. Silva ssisaias

👨‍💻
:)
View GitHub Profile
public class ClassicSingleton {
private static ClassicSingleton instance = null;
protected ClassicSingleton() {
// Exists only to defeat instantiation.
}
public static ClassicSingleton getInstance() {
if(instance == null) {
instance = new ClassicSingleton();
}
return instance;
@ssisaias
ssisaias / WebSecurityConfigFragment.java
Created December 4, 2016 05:15
SpringSecurity(4.1.3) Many Table Login example
//Login config
@Autowired
public void configAuthentication(AuthenticationManagerBuilder auth_1, AuthenticationManagerBuilder auth_2) throws Exception {
auth_1.jdbcAuthentication().dataSource(dataSource)
.usersByUsernameQuery(
"select login,password,1 from table1 where login=?")
.authoritiesByUsernameQuery(
"select login,role from table1 where login=?");
var fs = require('fs');
var obj = JSON.parse(fs.readFileSync('fileURI', 'utf8'));
total = 0;
// obj is the root element; you can change <items> for whatever array you like
obj.items.forEach(element => {
if(element.snippet.totalReplyCount>0){
element.replies.comments.forEach(reply => {
total++;
# 2018 - Isaias S. Silva
# This script converts the sentistrength output to a CSV one with zeros and ones, so we can use in a two class classifier.
import requests
import time
import datetime
import sys
import json
#Attention to the file names bellow
import nltk
import csv
import pickle
from nltk.tokenize import word_tokenize
from nltk.corpus import stopwords
from sklearn.naive_bayes import MultinomialNB
from myclassify import Analise # this should be found here: https://gist.github.com/ssisaias/fc49e7983a244b8c29b8f069f263216a
from pandas import DataFrame
import numpy
import nltk
import csv
import pickle
from nltk.tokenize import word_tokenize
from nltk.corpus import stopwords
from sklearn.naive_bayes import MultinomialNB
from myclassify import Analise
from pandas import DataFrame
import numpy
from sklearn.feature_extraction.text import CountVectorizer
import requests
import time
import datetime
import sys
import json
import re
#change the file name here. the file is generate by ytCommentMiner
dumpFile = open('videoei2-RjJDBHc2017-11-20-1200.json')
json_data = json.load(dumpFile)
import nltk
import csv
import pickle
from nltk.tokenize import word_tokenize
from nltk.corpus import stopwords
class Analise (object):
def __init__(self):
self.stop_words = set(stopwords.words("portuguese"))
self.dataPath_treino = 'output.txt'
@ssisaias
ssisaias / WSO2-Axiom-RemoveTagFromPayload.java
Last active April 18, 2019 16:57
Remove tag from payload using WSO2 axiom engine and custom mediators
public boolean mediate(MessageContext context) {
try {
String test = context.getProperty("mock_property").toString();
OMElement xmlPayload = AXIOMUtil.stringToOM(test);
//log.info(xmlPayload);
OMElement envelope = context.getEnvelope().getBody().getFirstElement();
//log.info(envelope);
OMElement body = envelope.getFirstElement();
//log.info(body);
OMElement items = body.getFirstElement();
[Rainmeter]
Update=5000
Background=#@#Background.png
; #@# is equal to Rainmeter\Skins\illustro\@Resources
BackgroundMode=3
BackgroundMargins=0,34,0,14
[Metadata]
; Contains basic information of the skin.
Name=System