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.stackoverflow.questions; | |
public class LayerImpl implements LayerProcessor { | |
@Override | |
public int apply(final int[][] data, final int x, final int y) { | |
int[] col = data[x]; | |
int accumulator = col[y] * 2 | |
+ data[x-1][y] | |
+ data[x+1][y] | |
+ col[y-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.stackoverflow.questions; | |
public class BlurShader implements Shader { | |
@Override | |
public int apply(final int[] d, final int s, final int x, final int y) { | |
final int p = s * y + x; | |
final int a = d[p] * 2 | |
+ d[p - 1] | |
+ d[p + 1] | |
+ d[p - 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
# VM invoker: /usr/java/jdk1.8.0_11/jre/bin/java | |
# VM options: <none> | |
# Warmup: 20 iterations, 1 s each# Measurement: 20 iterations, 1 s each | |
# Threads: 1 thread, will synchronize iterations | |
# Benchmark mode: Throughput, ops/time | |
# Benchmark: com.stackoverflow.questions.ShaderBench.testProcessProc | |
# Run progress: 0.00% complete, ETA 00:20:00 | |
# Fork: 1 of 10 | |
# Preparing profilers: perfasm |
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
# VM invoker: /usr/java/jdk1.8.0_11/jre/bin/java | |
# VM options: <none> | |
# Warmup: 20 iterations, 1 s each | |
# Measurement: 20 iterations, 1 s each | |
# Threads: 1 thread, will synchronize iterations | |
# Benchmark mode: Throughput, ops/time | |
# Benchmark: com.stackoverflow.questions.ShaderBench.testProcessProc | |
Forking 10 times using command: [perf, record, -F 1000, -e cycles,instructions, -o/tmp/jmh4344991220022041242perfbin, /usr/java/jdk1.8.0_11/jre/bin/java, -XX:+UnlockDiagnosticVMOptions, -XX:+TraceClassLoading, -XX:+LogCompilation, -XX:LogFile=/tmp/jmh6423091247981809078hslog, -XX:+PrintAssembly, -XX:+PrintCompilation, -XX:+PrintInlining, -XX:CompileCommandFile=/tmp/jmh3299179036504755608compilecommand, -cp, benchmarks.jar, org.openjdk.jmh.runner.ForkedMain, 127.0.0.1, 52178] | |
# Run progress: 0.00% complete, ETA 00:20:00 |
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 add = (a, b) -> { | |
a + b; | |
}; | |
val sub = (a, b) -> { | |
a - b; | |
}; | |
val square = (a) -> { | |
a * a; | |
}; | |
val cube = (a) -> { |
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
function EXT_COLOR () { echo -ne "\e[38;5;$1m"; } | |
function CLOSE_COLOR () { echo -ne '\e[m'; } | |
export CLICOLOR=1 | |
export PS1="\[`EXT_COLOR 187`\]\u@\h\[`CLOSE_COLOR`\]\[`EXT_COLOR 174`\] \w \$ \[`CLOSE_COLOR`\] > " | |
export LS_COLORS='di=38;5;108:fi=00:*svn-commit.tmp=31:ln=38;5;116:ex=38;5;186:*java=38;5;94:*groovy=38;5;95' | |
function cds() { | |
C=0; |
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
to find the linearly interpolated value of (x + 0.4, y + 0.7) | |
given the values at (x, y), (x, y+1), (x+1, y), and (x+1, y+1) | |
let x1 = val(x, y) * 0.4 + (val(x, y+1) * 0.6) | |
let x2 = val(x+1, y) * 0.4 + (val(x+1, y+1) * 0.6) | |
the final value is (x1 * 0.7 + (x2 * 0.3)) | |
generalized: |
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
# Change the external_url to the address your users will type in their browser | |
external_url 'http://code.domain.com' | |
git_data_dir '/opt/git/' | |
default_can_create_group false | |
username_changing_enabled false | |
signup_enabled false | |
gitlab_rails['extra_google_analystics_id'] = 'id' | |
# LDAP Auth | |
gitlab_rails['ldap_enabled'] = true |
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 Shader = require("./Shader"); | |
export = BlurShader; | |
class BlurShader implements Shader { | |
apply(d:number[], o:number[], s:number, xmin:number, xmax:number, ymin:number, ymax:number) { | |
for (var y:number = ymin; y < ymax; ++y) { | |
for (var x:number = xmin; x < xmax; ++x) { | |
var p:number = y * s + x; | |
var a:number = d[p] * 2 |
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
var BlurShader = (function () { | |
function BlurShader() { | |
} | |
BlurShader.prototype.apply = function (d, o, s, xmin, xmax, ymin, ymax) { | |
for (var y = ymin; y < ymax; ++y) { | |
for (var x = xmin; x < xmax; ++x) { | |
var p = y * s + x; | |
var a = d[p] * 2 + d[p - 1] + d[p + 1] + d[p - s] + d[p + s]; | |
a = (1000 * (a + 500)) / 6000; |
OlderNewer