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
public class Main { | |
public static final Object LOCK = new Object(); | |
public static void main(String[] args) throws InterruptedException { | |
new Thread(new A()).start(); | |
new Thread(new B()).start(); | |
} | |
} |
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
public class B { | |
public Object lock = new Object(); | |
public String foo() { | |
return "foo"; | |
} | |
public synchronized String bar() { | |
return "bar"; |
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
package bencode | |
import ( | |
"fmt" | |
"io" | |
"reflect" | |
) | |
func Encode(w io.Writer, x interface{}) { | |
v := reflect.ValueOf(x) |
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
vagrant@vagrant-ubuntu-precise-64:/opt/proj$ LEIN_HOST=0.0.0.0 lein repl :headless | |
Retrieving cider/cider-nrepl/0.8.1/cider-nrepl-0.8.1.pom from clojars | |
Retrieving compliment/compliment/0.2.0/compliment-0.2.0.pom from clojars | |
Retrieving cider/cider-nrepl/0.8.1/cider-nrepl-0.8.1.jar from clojars | |
Retrieving compliment/compliment/0.2.0/compliment-0.2.0.jar from clojars | |
/opt/proj/.git/HEAD | |
/opt/proj/.git/refs/heads/content | |
nREPL server started on port 49301 on host 127.0.0.1 - nrepl://127.0.0.1:49301 |
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
user> (debugger.core/describe-connectors) | |
name: com.sun.jdi.CommandLineLaunch | |
class: com.sun.tools.jdi.SunCommandLineLauncher | |
description: Launches target using Sun Java VM command line and attaches to it | |
type: launching | |
transport: dt_socket | |
default: true | |
arguments: home=/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/jre | |
options= | |
main= |
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
user> (debugger.core/attach) | |
-> new set | |
class: com.sun.tools.jdi.EventSetImpl$VMStartEventImpl | |
-> new set | |
class: com.sun.tools.jdi.EventSetImpl$ClassPrepareEventImpl | |
suspend policy: 2 | |
enabled: true | |
breakpoint set | |
-> new set | |
class: com.sun.tools.jdi.EventSetImpl$BreakpointEventImpl |
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 '(ch.qos.logback.classic Level Logger) | |
(org.slf4j LoggerFactory)) | |
(defmacro with-storm-log-level | |
[level & body] | |
`(let [slogger# (LoggerFactory/getLogger "root") | |
zlogger# (LoggerFactory/getLogger | |
"org.apache.zookeeper.server.NIOServerCnxn") | |
slevel# (.getLevel slogger#) | |
zlevel# (.getLevel zlogger#)] |
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
~:$ lein new app foo | |
Generating a project called foo based on the 'app' template. | |
~:$ cd foo | |
foo:$ tree | |
. | |
├── LICENSE | |
├── README.md | |
├── doc | |
│ └── intro.md | |
├── project.clj |
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
user=> (take 3 (map #(do (println %) %) (range 100))) | |
(0 | |
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 |
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 java.nio.ByteBuffer; | |
public class U { | |
public static void main(String[] args) { | |
int i = Integer.MAX_VALUE; | |
int xint = 1419258235; | |
int yint = 1411392235; | |
System.out.println("let x = " + xint); | |
System.out.println("let y = " + yint); |