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
import sys.process._ | |
(0 to 510 by 30).flatMap(p => "(http://sp6.fotolog.com[^\"]+)".r.findAllIn(s"curl -s http://www.fotolog.com/_tixa14/mosaic/$p/" !!)) | |
.map(_.replaceAll("_t.jpg", "_f.jpg")) | |
.foreach(u => s"wget $u" !!) |
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
import scala.tools.ant.sabbus.Break | |
object test { | |
println("Welcome to the Scala worksheet") //> Welcome to the Scala worksheet | |
val vetorInverso = Map( 0 -> 0, 1 -> 5, 2 -> 4, 3 -> 3, 4 -> 2, 5 ->1 ) | |
//> vetorInverso : scala.collection.immutable.Map[Int,Int] = Map(0 -> 0, 5 -> 1 | |
//| , 1 -> 5, 2 -> 4, 3 -> 3, 4 -> 2) | |
vetorInverso(3) //> res0: Int = 3 |
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
#!/bin/bash | |
# This is a fix for my samsung np900x4c laptop, who doesn't seem to shutdown nicely when low on battery | |
# Just put this in your cron (Runs every 1 minute). | |
# * * * * * /home/YOURUSERNAME/bin/suspend-on-low-battery | |
# ==== START FIX ==== | |
# Command notify-send would not show the message on your | |
# screen when started by cron. | |
# This fix will work in any crontab. sudo crontab-e or crontab -e |
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
import akka.actor.ActorSystem | |
import scala.concurrent.duration._ | |
val actorSystem = ActorSystem() | |
val scheduler = actorSystem.scheduler | |
val task = new Runnable { def run() { println("Hello") } } | |
implicit val executor = actorSystem.dispatcher | |
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
def create(userId: String, feedItemId: String) { | |
println("user: "+userId + " clipou: "+feedItemId) | |
redisClientPool.withClient { implicit client => | |
val itemsAdded = addItemToClips(userId, feedItemId) | |
if (itemsAdded != 0) { | |
addClipToTimeline(userId, feedItemId) | |
userFollowersSet(userId).flatten.foreach { followerId => | |
addClipToTimeline(followerId, feedItemId) | |
} | |
} |
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
#!/bin/bash | |
echo ; echo | |
echo "Create test index" | |
curl -XPUT localhost:9200/testindex?pretty=true | |
echo ; echo | |
echo "Insert doc 1" | |
curl -XPUT http://localhost:9200/testindex/article/1?pretty=true -d '{ |
NewerOlder