This file contains hidden or 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
var error = undefined; | |
var result = "wee!"; | |
var chainableMethod = function () { | |
return new Promise(function(resolve, reject) { | |
if (error) { | |
console.log('got error'); | |
return reject(error); | |
} | |
console.log('no error'); |
This file contains hidden or 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
require 'sidekiq/api' | |
namespace :sidekiq do | |
desc 'Output Sidekiq Status' | |
task status: :environment do | |
divider = '==================================================' | |
puts "#{divider}\nSTATS" | |
stats = Sidekiq::Stats.new | |
puts "\tProcesses:\t#{stats.processes_size}" |
This file contains hidden or 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
"" | |
.getClass.getMethods.map(_.getName) // methods | |
.sorted // sort | |
.filter(_ matches "(?i).*index.*") // grep /index/i | |
///////// | |
implicit def toMethods(obj: AnyRef) = new { | |
def methods = obj.getClass.getMethods.map(_.getName) | |
} |
This file contains hidden or 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 'open-uri' | |
require 'json' | |
require 'pp' | |
ZEP_HOST = 'localhost' | |
ZEP_PORT = 8890 | |
ZEP_ADDR = "http://#{ZEP_HOST}:#{ZEP_PORT}" |
This file contains hidden or 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
FROM busybox | |
ARG MESSAGE | |
RUN echo $MESSAGE > message.txt |
This file contains hidden or 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 'json' | |
require 'net/http' | |
require 'open-uri' | |
require 'pp' | |
require 'uri' | |
ZEP_HOST = 'localhost' | |
ZEP_PORT = 8890 |
This file contains hidden or 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
//////////////////////////////////////////////////////////////////////////////////////////////////// | |
// Custom UDF | |
//////////////////////////////////////////////////////////////////////////////////////////////////// | |
// define method | |
def isNumeric: (String => Boolean) = { | |
case null => false | |
case value => value forall Character.isDigit | |
} | |
val ISNUMERIC = udf(isNumeric) |
This file contains hidden or 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 method1 = function() { | |
console.log("method1") | |
return true | |
} | |
let method2 = function() { | |
console.log("method2") | |
return true | |
} |
This file contains hidden or 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
Map<String, Long> counted = list.stream() | |
.collect(Collectors.groupingBy(Function.identity(), Collectors.counting())); | |
Map<String, Long> sorted = counted.entrySet().stream() | |
.sorted(Collections.reverseOrder(Map.Entry.comparingByValue())) | |
.limit(10) | |
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new)); |
This file contains hidden or 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
# usage | |
nvm use . | |
npm install | |
chmod +x export-spark-driver-logs.sh | |
./export-spark-driver-logs.sh $ES_IP:$ES_PORT driver-##############-#### |