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
from itertools import combinations | |
[p for p in combinations([(i, i+1) for i in range(1,5)],2) if p[0][0] not in p[1] and p[0][1] not in p[1]] |
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
# set to appropriate manifest for your distribution and version | |
MANIFEST=http://cdimage.ubuntu.com/lubuntu/releases/14.10/release/lubuntu-14.10-desktop-amd64.manifest | |
aptitude search '~i !~M' -F '%p' --disable-columns | sort -u > currentlyinstalled.txt | |
wget -qO - $MANIFEST | cut -f1 | sort -u > defaultinstalled.txt | |
comm -23 currentlyinstalled.txt defaultinstalled.txt |
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 org.apache.spark.streaming._ | |
import org.apache.spark.streaming.kafka._ | |
import org.apache.spark.{Logging, SparkConf} | |
import scala.language.implicitConversions | |
object SimpleStreamer extends Logging { | |
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
scalacOptions in (Compile, console) ++= Seq( | |
"-i", "init.sc" | |
) | |
libraryDependencies ++= Seq( | |
"com.twitter" %% "algebird-core" % "0.10.2", | |
"com.twitter" %% "algebird-util" % "0.10.2", | |
"com.twitter" %% "algebird-bijection" % "0.10.2" | |
) |
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
#!/bin/sh | |
LOG="puppet.log.`date +%Y-%m-%d.%H-%M-%S`" | |
OPTS="--server puppet.server.com --onetime --no-daemonize --verbose --detailed-exitcodes --color false" | |
while read HOST; do | |
echo "*** Processing $HOST" | tee -a $LOG | |
ssh -oBatchMode=yes -n $HOST "sudo puppet agent $OPTS 2>&1" 2>&1 | tee -a $LOG | |
done < hosts.txt |
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
df2=df.rdd.map(lambda row: Row(**dict(row.asDict(), test_name=row.TEST_NAME.strip().lower()))).toDF() |
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 UIKit.UIFont | |
public extension UIFont { | |
/// Helper method to create a UIFont with updated attributes applied to the UIFontDescriptor | |
/// | |
/// - parameter attributes: The new attributes to apply to the fontDescriptor | |
/// | |
/// - returns: A UIFont object with the new attributes appended to the receivers fontDescriptor | |
func addingAttributes(_ attributes: [UIFontDescriptor.AttributeName : Any] = [:]) -> UIFont { |