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
| # coding: utf-8 | |
| # Description: 用于生成周报模板 | |
| ## 将本文件保存为 Rakefile,放在存放周报的目录。 | |
| ## 在周报目录创建一个名为 .title 的文件,设置标题,例如 『存储与网站工作周报』,用于设置标题,如果没有提供,默认为『工作周报』。 | |
| ## 命令: | |
| ## rake new -- 创建周报 | |
| ## rake clean -- 删除周报 | |
| task default: %w[new] |
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
| public class Test { | |
| private static int plusOne(int i) { | |
| return ++i; | |
| } | |
| private static long oneForMethod(int x, int times) { | |
| long start = System.nanoTime(); | |
| for (int i = 0; i < times; i++) { |
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
| defmodule PingPong do | |
| def test(n, m) do | |
| parent = self() | |
| spawn fn -> | |
| s = :erlang.monotonic_time(:microsecond) | |
| {cs1,_} = :erlang.statistics(:context_switches) | |
| {r1, _} = :erlang.statistics(:reductions) | |
| first = self() | |
| last = start(first, n, m) |
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
| (ns test-delay | |
| (:import [java.util.concurrent CyclicBarrier])) | |
| (defn benchmark-delay [threads] | |
| (let [n (rand-int 100) | |
| d (delay (inc n)) | |
| ret (inc n) | |
| ^CyclicBarrier barrier (CyclicBarrier. (+ threads 1))] | |
| (dotimes [_ threads] | |
| (-> |
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
| cyear=$(date +"%Y") | |
| cmonth=$(date +"%m") | |
| cday=$(date +"%d") | |
| isnum() { awk -v a="$1" 'BEGIN {print (a == a + 0)}'; } | |
| for b in `git branch` | |
| do | |
| if [[ $b == feature/201* ]]; | |
| then |
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
| package net.fnil.java8_examples; | |
| import java.util.concurrent.CountDownLatch; | |
| import java.util.concurrent.CyclicBarrier; | |
| import java.util.concurrent.atomic.AtomicInteger; | |
| public class BusyLock { | |
| private int count; | |
| private AtomicInteger state; |
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
| public class FalseSharing implements Runnable { | |
| public final static int NUM_THREADS = 4; // change | |
| public final static long ITERATIONS = 500L * 1000L * 1000L; | |
| private final int arrayIndex; | |
| private static VolatileLong3[] longs = new VolatileLong3[NUM_THREADS]; | |
| static { | |
| for (int i = 0; i < longs.length; i++) { | |
| longs[i] = new VolatileLong3(); |
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
| public class L1CacheMiss { | |
| private static final int RUNS = 10; | |
| private static final int DIMENSION_1 = 1024 * 1024; | |
| private static final int DIMENSION_2 = 62; | |
| private static long[][] longs; | |
| public static void main(String[] args) throws Exception { | |
| Thread.sleep(10000); | |
| longs = new long[DIMENSION_1][]; |
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
| (defn- get-ip-num [^String ip] | |
| (when ip | |
| (when-let [groups (re-matches #"^(\d+)\.(\d+)\.(\d+)\.(\d+)$" ip)] | |
| (let [[a b c d] (map #(Integer/valueOf ^String %) (next groups))] | |
| (+ | |
| (* 256 256 256 a) | |
| (* 256 256 b) | |
| (* 256 c) | |
| d))))) |
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
| From d918ba819dc67d9977c3a13c1d3ac16e46e02dc4 Mon Sep 17 00:00:00 2001 | |
| From: dennis zhuang <killme2008@gmail.com> | |
| Date: Tue, 28 Jun 2016 00:30:16 +0800 | |
| Subject: [PATCH] Patch Compiler#resolveIn to introduce method_missing | |
| --- | |
| src/jvm/clojure/lang/Compiler.java | 23 ++++++++++++++++++++--- | |
| src/jvm/clojure/lang/Var.java | 9 +++++++++ | |
| 2 files changed, 29 insertions(+), 3 deletions(-) |