Skip to content

Instantly share code, notes, and snippets.

@brianyu0717
brianyu0717 / citrix-icaclient-install-notes.md
Created July 16, 2023 16:41
Citrix install notes on linux
@brianyu0717
brianyu0717 / bash_aliases
Last active September 23, 2019 08:54
Alias for Bash that are used by me
alias gca='git commit --amend'
alias gcan='git commit --amend --no-edit'
alias gpfm='git push origin HEAD:refs/for/master'
alias gprb='git pull --rebase'
alias grpo='git remote prune origin'
alias gs='git status'
alias ll='ls -l'
alias ls='ls -F --color=auto --show-control-chars'
alias mci2s='mvn clean install -T 2C -DskipTests'
alias taillast='ls -lt | awk '\''{print $9}'\'' | head -2 | xargs tail -f'
final double[] values = //...
List<Double> doubles = Arrays.asList(ArrayUtils.toObject(values));
return doubles.stream().map( d -> (Function<InputData, Double>) (v) -> d).collect(Collectors.toList());
import java.lang.reflect.Type
import java.util
import com.google.gson._
/**
* Cannot get scala list to work nicely so resorted to Java List for the time being
*/
object SimpleExample extends App {
@brianyu0717
brianyu0717 / ThreeFunction.java
Created October 11, 2017 07:59
Simple FunctionalInterface example for Java
@FunctionalInterface
public interface ThreeFunction<A, B , C, R> {
R apply(A a, B b, C c);
}
@brianyu0717
brianyu0717 / ThreadPoolExample.kt
Last active February 2, 2018 21:39
Using a bit of java.util.concurrent with Kotlin
// basic example of executing tasks in parallel
fun main(args: Array<String>) {
val strings = listOf("a", "b", "c")
val printStringTasks = mutableListOf<Callable<Unit>>()
strings.forEach { printStringTasks.add(Callable<Unit>({
println("starting task: $it")
Thread.sleep(2000)
println("finished task: $it")
}))}
@brianyu0717
brianyu0717 / GenericsExample.kt
Last active November 20, 2016 14:28
Kotlin generics, inheritence and interfaces example showing multiple interface implementation, inheritance and co-/contra-variance in generics
interface MustImplementAdd {
fun theAddLol() : Int
}
interface MustImplementDivide {
fun divide(a: Float, b: Float) : Float
}
abstract class Calculator(val name: String) {
abstract fun calculate() : Double
@brianyu0717
brianyu0717 / ArrayMapChallenge
Created July 25, 2016 18:48
Programming challenge
Given an array of strings representing a tree. Translate this to a tree.
Example.
["1", "1.1", "1.1.1", "1.2", "1.3", "1.3.1", "2", "2.1"]
Would result in the below tree:
{
key: 'root',
@brianyu0717
brianyu0717 / gist:4dc606a2180f81455495
Last active March 18, 2016 23:51
Spring Boot Maven build plugins for EmberJs
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<executions>
<execution>
<id>build prod version of static site</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>