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
#!/usr/bin/env python | |
import threading, time | |
time1 = 0 | |
def get_time1(): | |
return time1 | |
def get_time2(): |
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
(ns load-blancer | |
(:import [org.zeromq ZMQ ZMQ$PollItem ZMQ$Poller])) | |
; the functionality of this is same with zmq-server.clj, but we handle routing manually | |
(defn dequeue! [queue-ref] | |
(dosync | |
(let [q @queue-ref | |
result (peek q) | |
remain (if (= q []) | |
[] |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <signal.h> | |
int signaled = 0; | |
void handler(int ignored) { | |
signaled = 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
package com.example; | |
public class Complete { | |
public int i; | |
private String s; | |
public Complete(int i, String s) { | |
this.i = i; | |
this.s = s; | |
} |
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.io.*; | |
public class ClassLoaderTest { | |
public static void main(String[] args) throws Exception { | |
ClassLoader myLoader = new ClassLoader() { | |
@Override | |
public Class<?> loadClass(String name) throws ClassNotFoundException { | |
try { | |
String fileName = "foo/" + name.replace('.', '/') + ".class"; | |
System.out.println(fileName); |
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.lang.annotation.ElementType; | |
import java.lang.annotation.Retention; | |
import java.lang.annotation.RetentionPolicy; | |
import java.lang.annotation.Target; | |
import java.lang.reflect.Method; | |
import java.lang.NoSuchMethodException; | |
public class T { | |
public static void main(String[] args) throws Exception { | |
executeWithAnnotationSupport(T.class, "doSomething"); |
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
; It's been a long time that Typed Clojure couldn't annotate `hash-map` using | |
; first class type. Because these functions require even number of arguments, | |
; and also have some special type constrain on its arguments. | |
; So we used to check these functions using special handler in checker. | |
; One of my GSOC goal is to make it possible to type check these kind of | |
; function without special handler. | |
; And now I made it. Thanks Sam Tobin-Hochstadt and Asumu Takikawa who inspired | |
; us. | |
; You can try it at my fork of Typed Clojure | |
; https://github.com/xudifsd/core.typed/tree/repeat-support |
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
(defmacro defasync [name args & body] | |
(if config/in-test? | |
`(defn ~name ~args ~@body) | |
(let [name-str (str name)] | |
`(defn ~name ~args | |
(future | |
(try | |
~@body | |
(catch Exception e# | |
(log/error (str ~name-str |
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
(defn self-is-active? | |
[{{:keys [uid]} :params :as req}] | |
(when-not (nil? uid) | |
(let [user-id (u/->int uid) | |
user (users/get-user-by-id user-id)] | |
(when-not (nil? user) | |
(not (:inactive user)))))) | |
(defn self-belongs-to-team? | |
[{{:keys [uid subdomain]} :params :as req}] |
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
(defn self-is-active? | |
[{{:keys [uid]} :params :as req}] | |
(when-not (nil? uid) | |
(let [user-id (u/->int uid) | |
user (*get-user-by-id* user-id)] | |
(when-not (nil? user) | |
(not (:inactive user)))))) | |
(defn self-belongs-to-team? | |
[{{:keys [uid subdomain]} :params :as req}] |
OlderNewer