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
mvn help:evaluate -Dexpression=project.version | grep -e '^[^\[]' |
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
trait TypeContainer { | |
type A | |
type B | |
type ABPlus | |
type C | |
} | |
trait TypeProjector[TC <: TypeContainer] { | |
type A = TC#A | |
type B = TC#B |
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
{ val u = classOf[sun.misc.Unsafe].getDeclaredField("theUnsafe") | |
u.setAccessible(true) | |
u.get(null).asInstanceOf[sun.misc.Unsafe] | |
} freeMemory 1024 |
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
// Inspired by latest OCaml | |
eval() match { | |
case v1 => | |
case v2 => | |
case _ => | |
case catch e: Exception => | |
case catch _ => | |
case finally => |
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
implicit class GoodLord(val Good: Int) extends AnyVal { | |
def Lord = Good | |
} | |
// and then in a Scala prompt: | |
// scala> 1.Good.Lord | |
// res0: Int = 1 | |
// Also: | |
// scala> 1.Good.Lord.Good.Lord.Good.Lord |
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
iptables -I INPUT 1 -p udp --dport 60000:61000 -j ACCEPT | |
service iptables save |
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
git log --since=2012-10-01 --until=2012-10-31 --author=loverdos --reverse --pretty=format:"%H%x09%ae%x09%ad%x09%s" --date=short |
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 (|>) : 'a -> ('a -> 'b) -> 'b = "%revapply" |
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
-- All files (and the folders they belong to) recursively | |
with recursive q as ( | |
select folder, | |
1 as level, | |
'' || folder.name as folder_path, | |
'' || folder.name || '/' || file.name as file_path, | |
folder.id as folder_id, | |
folder.parent_id as parent_folder_id, | |
file.id as file_id | |
from folder, |
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
// Parallel port scanner using parallel collections (just for the side-effect) | |
// @author = @loverdos | |
(1 to 65536).par.map { case port ⇒ | |
try { | |
val socket = new java.net.Socket("127.0.0.1", port) | |
socket.close() | |
println(port) | |
port | |
} catch { |