Skip to content

Instantly share code, notes, and snippets.

View jonyfs's full-sized avatar

Jony Santos jonyfs

View GitHub Profile
@lucascs
lucascs / Calculadora.java
Created February 21, 2011 20:48
Programação funcional em Java
public class Calculadora {
private static final Prova _ = of(Prova.class);
public double mediaDeProvas(List<Prova> provas) {
return mediaPonderada(provas, function(_.getNota()), function(_.getPeso()));
}
public <T> double mediaPonderada(List<T> lista, Function<T, Double> valor, Function<T, Double> peso) {
double soma = 0.0;
double somaPesos = 0.0;
@raphaellondner-mongodb
raphaellondner-mongodb / lambda-mongodb-example
Last active March 11, 2020 02:37
MongoDB-Lambda-Example
'use strict'
const AWS = require('aws-sdk');
var MongoClient = require('mongodb').MongoClient;
let atlas_connection_uri;
exports.handler = (event, context, callback) => {
var uri = process.env['MONGODB_ATLAS_CLUSTER_URI'];
if (atlas_connection_uri != null) {
@reddikih
reddikih / convertBytebufferToString.java
Last active April 10, 2020 18:17
java convert bytebuffer to string
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
...
/**
Method Usage
ByteBuffer bf = string2ByteBuffer("test", Charset.forName("UTF-8"));
**/
@rponte
rponte / AcessaWsDaSefaz.java
Created August 20, 2014 14:44
Acessando WS da Sefaz para NF-e
package br.com.syspdv.nfe.utils;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.net.URL;
import java.security.Security;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.MimeHeaders;
import javax.xml.soap.SOAPConnection;
@giansalex
giansalex / README.md
Last active April 25, 2020 21:23
Sonarqube Docker Compose - Alpine

SonarQube Docker

  • Create a directory for project
  • Copy docker-compose.yml
  • Create /extensions in project directory.
  • Run docker-compose up -d
@paulfairless
paulfairless / gist:81eb87bd5a0e1b3a6d048ee913efc79a
Created April 4, 2017 13:09
Specify pool for spring-cloud-aws SQS listener
package com.endource.aws
import com.amazonaws.services.sqs.AmazonSQSAsync
import com.amazonaws.services.sqs.model.Message
import com.amazonaws.services.sqs.model.MessageAttributeValue
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.cloud.aws.messaging.config.SimpleMessageListenerContainerFactory
@AlexZeitler
AlexZeitler / setup-oh-my-zsh-powerlevel9k.sh
Created May 13, 2018 19:30
Installing zsh / oh-my-zsh / Powerlevel9k on Ubuntu 18.04
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k
wget https://github.com/powerline/powerline/raw/develop/font/PowerlineSymbols.otf
wget https://github.com/powerline/powerline/raw/develop/font/10-powerline-symbols.conf
mkdir ~/.local/share/fonts/
mv PowerlineSymbols.otf ~/.local/share/fonts/
fc-cache -vf ~/.local/share/fonts/
mkdir ~/.config/fontconfig/conf.d/
mv 10-powerline-symbols.conf ~/.config/fontconfig/conf.d/
echo "Log out of your session and login again."
@ateucher
ateucher / setup-gh-cli-auth-2fa.md
Last active June 28, 2022 07:16
Setup git on the CLI to use 2FA with GitHub

These are instructions for setting up git to authenticate with GitHub when you have 2-factor authentication set up. This authentication should be inherited by any GUI client you are using. These are intentionally brief instructions, with links to more detail in the appropriate places.

  1. Download and install the git command-line client (if required).

  2. Open the git bash window and introduce yourself to git (if required):

    git config --global user.name 'Firstname Lastname'
    git config --global user.email 'firstname.lastname@gov.bc.ca'
    
@reyjrar
reyjrar / New-iTerm-Window.scpt
Created February 8, 2012 13:14
AppleScript to Open a New iTerm Window and bring it to the front
(*
* New-iTerm-Window.scpt
*
* Intended for use with QuickSilver
* I mapped option-y to running this script to create
* a new iTerm window on the current workspace
*
* Based on much Googling - very little "original" code here
* Comments/Suggestions to brad.lhotsky@gmail.com
*)
@shortjared
shortjared / nginx.conf
Last active June 19, 2023 18:29
AWS API Gateway Nginx Reverse Proxy
# NOTE
#
#
# Use sed on the instance up to replace the INSTANCE_ID and DNS_RESOLVER with the following commands
#
####################################################################################################
# Fetch the private IP for resolving DNS dynamically in nginx
# We also need to escape the `.` from it for usage in later sed
#
# DNS_RESOLVER=`grep nameserver /etc/resolv.conf | cut -d " " -f2 | sed 's/\./\\./g'`