Skip to content

Instantly share code, notes, and snippets.

View liufuyang's full-sized avatar
🦀
Rust is good

Fuyang Liu liufuyang

🦀
Rust is good
View GitHub Profile
@liufuyang
liufuyang / G1Test.java
Created November 21, 2019 00:16
CompletableFutures newWorkStealingPool test
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import org.slf4j.Logger;
@liufuyang
liufuyang / fastlen_test.go
Last active March 21, 2019 08:59
Benchmark function speed to get the length of string of a uint64
package fastlen
import (
"math/rand"
"strconv"
"testing"
)
func LenUint64A(x uint64) int {
return len(strconv.FormatUint(x, 10))
@liufuyang
liufuyang / SenderClassiferExample.java
Created January 1, 2018 13:18
dl4j-acc-cuda-outOfMem-issue
import org.datavec.api.records.reader.RecordReader;
import org.datavec.api.records.reader.impl.csv.CSVRecordReader;
import org.datavec.api.split.FileSplit;
import org.datavec.api.util.ClassPathResource;
import org.deeplearning4j.datasets.datavec.RecordReaderDataSetIterator;
import org.deeplearning4j.eval.Evaluation;
import org.deeplearning4j.nn.api.OptimizationAlgorithm;
import org.deeplearning4j.nn.conf.MultiLayerConfiguration;
import org.deeplearning4j.nn.conf.NeuralNetConfiguration;
import org.deeplearning4j.nn.conf.Updater;
@liufuyang
liufuyang / init_python3_ml_env.sh
Last active September 6, 2021 13:32
init_python3_ml_env.sh
#!/bin/bash
set -e
PYTHON_ENV_NAME=venv
pip3 install virtualenv
virtualenv -p python3 $PYTHON_ENV_NAME
echo "source $(pwd)/$PYTHON_ENV_NAME/bin/activate" > .env
@liufuyang
liufuyang / tailc
Last active April 15, 2024 02:31
Color output of linux tail command
#!/bin/bash
# save this file as tailc then
# run as: $ tailc logs/supplier-matching-worker.log Words_to_highlight
file=$1
if [[ -n "$2" ]]; then
color='
// {print "\033[37m" $0 "\033[39m"}
/(WARN|WARNING)/ {print "\033[1;33m" $0 "\033[0m"}
/(ERROR|CRIT)/ {print "\033[1;31m" $0 "\033[0m"}