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
# create a test.py file to spark-submit | |
cat << EOF > test.py | |
# Import SparkSession | |
from pyspark.sql import SparkSession | |
# Create SparkSession | |
spark = SparkSession.builder \ | |
.master("local[1]") \ | |
.appName("SparkByExamples.com") \ | |
.getOrCreate() |
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
@override | |
public boolean equals(final Object object) { | |
if (this == object) { | |
return true; | |
} | |
if (!(object instanceof KnowledgePackageImpl)) { | |
return false; | |
} |
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
@Grab('commons-lang:commons-lang:2.5') | |
import org.apache.commons.lang.RandomStringUtils as RSU | |
def randomClosure = { size, letters, numbers -> | |
// Invoke RandomStringUtils.random() method | |
RSU.random size, letters, numbers | |
} | |
def randomNumbers = randomClosure.rcurry(false, true) // letters = false, numbers = true | |
def randomLetters = randomClosure.ncurry(1, true, false) // letters = true, numbers = false |
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
// checking bindings snippets | |
if (binding.hasVariable('superVariable')) { | |
// your code here | |
} | |
An easy solution to this is the following: | |
if (binding.variables.containsKey("bindingVar")) { | |
// do something | |
} | |
Or if you’d like to get a null value for an optional binding: |
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
spockReports { | |
// shows code blocks in report | |
set 'com.athaydes.spockframework.report.showCodeBlocks': true | |
// change the output dir of spock reports | |
set 'com.athaydes.spockframework.report.outputDir': 'target/spock-reports' | |
// using templates | |
set 'com.athaydes.spockframework.report.IReportCreator': 'com.athaydes.spockframework.report.template.TemplateReportCreator' | |
// Set properties of the report creator | |
set 'com.athaydes.spockframework.report.template.TemplateReportCreator.specTemplateFile':'/reportTemplates/spec-template.md' | |
set 'com.athaydes.spockframework.report.template.TemplateReportCreator.summaryTemplateFile':'/reportTemplates/summary-template.md' |
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
// https://mvnrepository.com/artifact/com.aestasit.infrastructure.sshoogr/sshoogr | |
@Grapes( | |
@Grab(group='com.aestasit.infrastructure.sshoogr', module='sshoogr', version='0.9.25', scope='runtime') | |
) | |
import static com.aestasit.infrastructure.ssh.DefaultSsh.* | |
/* | |
Consider localhost has a machine up with sshd listening to port 2222 |
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
@Grab('com.github.groovy-wslite:groovy-wslite:1.1.2') | |
import wslite.soap.* | |
def client = new SOAPClient('http://www.holidaywebservice.com/Holidays/US/Dates/USHolidayDates.asmx') | |
def response = client.send(SOAPAction:'http://www.27seconds.com/Holidays/US/Dates/GetMothersDay') { | |
body { | |
GetMothersDay('xmlns':'http://www.27seconds.com/Holidays/US/Dates/') { | |
year(2011) | |
} | |
} |
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/local/bin/groovy | |
@GrabConfig(systemClassLoader = true) | |
// change the resolver path and grab artifact details if you want ojdbc6 jar from some other repo | |
@GrabResolver(name = 'ojdbc6', root = 'https://mvnrepository.com/artifact/com.oracle/ojdbc6') | |
@Grapes( | |
@Grab(group = 'com.oracle', module = 'ojdbc6', version = '12.1.0.1-atlassian-hosted') | |
) | |
/* | |
# Spawning docker oracle xe for testing, if you already have oracle instance to test we don't need this |
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
wget https://ftp.gnu.org/gnu/emacs/emacs-26.1.tar.gz | |
tar xvf emacs-26.1.tar.gz | |
cd emacs-26.1 | |
./configure --without-selinux | |
make | |
sudo make install |
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |