Skip to content

Instantly share code, notes, and snippets.

@hmaurer
hmaurer / t078.js
Created December 9, 2012 00:55 — forked from Constellation/t078.js
function t1() {
var ary = [];
for (var i = 0; i < 10000000; ++i) {
ary[i] = i;
}
return ary;
}
function t2() {
var ary = [];
package org.mambo.core
import akka.actor._
import akka.util.ByteString
import scala.collection.mutable
/**
* @author Blackrush
*/
class LoginActor(port: Int) extends Actor with ActorLogging {
package org.mambo.core.io
import java.nio.charset.Charset
import java.nio.{CharBuffer, ByteBuffer}
/**
* @author Blackrush
*/
class BigEndianBuffer(private var buf: Array[Byte], var offset: Int = 0) extends Buffer {
import BigEndianBuffer._
require 'fiddle'
module IAmAHorriblePerson
def unset flag
value = _wrap self
flags = 8.times.map { |i| value[i] }.pack('C8').unpack('Q').first
[flags & ~flag].pack('Q').unpack('C8').each_with_index { |n,i|value[i] = n }
end
def class= k
@hmaurer
hmaurer / echo.go
Created August 11, 2013 12:33 — forked from paulsmith/echo.go
// $ 6g echo.go && 6l -o echo echo.6
// $ ./echo
//
// ~ in another terminal ~
//
// $ nc localhost 3540
package main
import (

Unix Command Line Notes

  • Application settings
    • Finder
      • Show path - defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES
      • Show hidden files - defaults write com.apple.finder AppleShowAllFiles TRUE
    • Mail
      • Minimum font size - defaults write com.apple.mail MinimumHTMLFontSize 14
  • Mac OSX commands
@hmaurer
hmaurer / demo.erl
Created December 11, 2013 18:16 — forked from volgar1x/demo.erl
-module (demo).
-export ([taille/1]).
-export ([somme/1]).
taille([]) -> 0;
taille([_|Tail]) -> 1 + taille(Tail).
somme([]) -> 0;
somme([Head|Tail]) -> Head + somme(Tail).
@hmaurer
hmaurer / intput.txt
Created February 24, 2014 00:10 — forked from bemasher/intput.txt
// This is the structure of the binary nbt file
TAG_Compound('Level') {
TAG_Compound('nested compound test') {
TAG_Compound('egg') {
TAG_String('name'): 'Eggbert'
TAG_Float('value'): 0.5
}
TAG_Compound('ham') {
TAG_String('name'): 'Hampus'
TAG_Float('value'): 0.75

Useful Scalac Flags

So, there have been some discussions and angry tweets recently about irritating Scala "features" (like value discarding and auto-tupling) that can actually be turned off by selecting the right compiler flag in conjunction with -Xfatal-warnings. I highly recommend a set of options something like those below.

scalacOptions ++= Seq(
  "-deprecation",           
  "-encoding", "UTF-8",       // yes, this is 2 args
  "-feature",                
 "-language:existentials",
... = begin
suc (a + suc b)
==< cong suc (lemma2 a b) >
suc (suc (a + b))
==< cong (suc.suc) (comm a b) >
suc (suc (b + a))
==< cong suc (sym (lemma2 b a)) >
suc (b + suc a)
[]