This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#################### | |
# EXTERNAL MODULES # | |
#################### | |
# https://docs.aws.amazon.com/powershell/latest/reference/Index.html | |
if (-not (Get-Module -ListAvailable -Name AWSPowerShell)) { | |
"AWS module is not installed. Let's get it installed..." | |
Install-Module -Name AWSPowerShell | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################### | |
# YOUR LOGS TO ELASTIC SEARCH # | |
############################### | |
function Get-ESConfig () { | |
[xml] $log4netConfig = Get-Content -Path $env:CONFIG_LOGGER_FILE | |
return $log4netConfig.log4net.appender | Where-Object { $_.name -eq "ElasticSearchAppender" } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function gcd(numbers) { | |
let results = {}; | |
for (let i = 0; i < numbers.length; i++) { | |
let divisor = numbers[i]; | |
for (let j = 0; j < numbers.length; j++) { | |
let number = numbers[j]; | |
if (number == divisor) continue; | |
let result = number % divisor; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Problem: Count the number of times a string appears as a substring in a longer text. | |
function patternCount(text, pattern) { | |
if (!text || !pattern) return -1; | |
let textLength = text.length; | |
let k = pattern.length; | |
let count = 0; | |
for (let i = 0; i < (textLength - k + 1); i++) { | |
let kmer = text.substring(i, i + k); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let HashTable = function() { | |
let entries = []; | |
this.put = (key, value) => { | |
let hashKey = hashCode(key); | |
let entry = entries[hashKey]; | |
// Linear Probing | |
while (entry) { | |
if (entry && entry[0] === key) break; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Net; | |
using System.Net.Sockets; | |
using System.Text; | |
using System.Threading; | |
using System.Threading.Tasks; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace CodeZone.Helpers.Async | |
{ | |
public static class TaskHelper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.defineProperty(Array.prototype, 'chunk', { | |
value: function(chunkSize) { | |
var R = []; | |
for (var i=0; i<this.length; i+=chunkSize) | |
R.push(this.slice(i,i+chunkSize)); | |
return R; | |
} | |
}); | |
Array.range(10).chunk(3); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "csv" | |
require "net/http" | |
require "date" | |
require "json" | |
# | |
# Get log data | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package br.com.mamutelanoso; | |
import java.io.IOException; | |
import java.util.Properties; | |
import javax.mail.BodyPart; | |
import javax.mail.Folder; | |
import javax.mail.Message; | |
import javax.mail.MessagingException; | |
import javax.mail.Multipart; |