Skip to content

Instantly share code, notes, and snippets.

Joe Wu joecwu

Block or report user

Report or block joecwu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View app-search-hack-engine.sh
#!/bin/bash
if [ -z $1 ]; then
echo "usage: $0 APP_SEARCH_HOST APP_SEARCH_AUTH ES_HOST ENGINE_NAME"
exit 1
else
APP_SEARCH_HOST=$1
fi
if [ -z $2 ]; then
@joecwu
joecwu / es-artist-converter.scala
Created Mar 29, 2019
Elasticsearch search result convert to MeCab-IPADIC format
View es-artist-converter.scala
import $ivy.`org.scalaz::scalaz-core:7.2.+`
import $ivy.`org.json4s::json4s-jackson:3.+`
import $ivy.`org.json4s::json4s-ext:3.+`
import $ivy.`com.github.nscala-time::nscala-time:2.18.+`
import scalaz._
import Scalaz._
import com.github.nscala_time.time.Imports._
import scala.io.Source
import org.json4s._
import org.json4s.jackson.JsonMethods._
@joecwu
joecwu / docker-compose-es-cluster.yml
Created Mar 2, 2018
docker-compose.yml for starting basic es cluster
View docker-compose-es-cluster.yml
version: '2'
services:
elasticsearch1:
image: docker.elastic.co/elasticsearch/elasticsearch:6.2.2
container_name: es1
environment:
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
@joecwu
joecwu / mongodb-s3-backup.sh
Created Jul 6, 2017 — forked from eladnava/mongodb-s3-backup.sh
Automatically backup a MongoDB database to S3 using mongodump, tar, and awscli (Ubuntu 14.04 LTS)
View mongodb-s3-backup.sh
#!/bin/sh
# Make sure to:
# 1) Name this file `backup.sh` and place it in /home/ubuntu
# 2) Run sudo apt-get install awscli to install the AWSCLI
# 3) Run aws configure (enter s3-authorized IAM user and specify region)
# 4) Fill in DB host + name
# 5) Create S3 bucket for the backups and fill it in below (set a lifecycle rule to expire files older than X days in the bucket)
# 6) Run chmod +x backup.sh
# 7) Test it out via ./backup.sh
View Blog-Docker-Push-Error.md
published tags
true
Docker

[Docker] Push Error

這篇同步發佈在我的BlogGist

背景

@joecwu
joecwu / Blog-Docker-Private-Registry.md
Last active Nov 7, 2015
[Docker] Private Registry
View Blog-Docker-Private-Registry.md
published tags
true
Docker

[Docker] Private Registry

這篇同步發佈在我的BlogGist

前言

最近開始run startup,非常忙碌,沒什麼時間寫blog,但是有些難找的東西,還是要記錄一下,看看能不能幫到別人。

@joecwu
joecwu / Blog-ScalaInDepth-Scala-Case-Classes.md
Last active Dec 19, 2016
[Scala In Depth] Scala Case Classes
View Blog-ScalaInDepth-Scala-Case-Classes.md
published tags
true
ScalaInDepth
Scala
Programming

[Scala In Depth] Scala Case Classes

這篇同步發佈在我的BlogGist

這篇文章,基本上是參考這篇Scala Case Classes In Depth來寫的,閱讀吸收後以我的例子與描述方式以中文寫下。

@joecwu
joecwu / Blog-ScaVa2Scala-Scalaz-Stream-Part2.md
Last active Aug 26, 2015
[ScaVa->Scala] Scalaz Stream 串流好朋友 part 2
View Blog-ScaVa2Scala-Scalaz-Stream-Part2.md
published tags
true
ScaVaToScala
Scala
Scalaz
Programming

[ScaVa->Scala] Scalaz Stream 串流好朋友 part 2

這篇同步發佈在我的BlogGist

前情提要

@joecwu
joecwu / Blog-ScaVa2Scala-Scalaz-Stream-Part1.md
Last active Aug 26, 2015
[ScaVa->Scala] Scalaz Stream 串流好朋友 part 1
View Blog-ScaVa2Scala-Scalaz-Stream-Part1.md
published tags
true
ScaVaToScala
Scala
Scalaz
Programming

[ScaVa->Scala] Scalaz Stream 串流好朋友 part 1

這篇同步發佈在我的BlogGist

何時用到Stream(串流)?

@joecwu
joecwu / Blog-ScaVaToScala-Scalaz-Task.md
Last active Aug 29, 2015
[ScaVa->Scala] Scalaz Task 取代Scala Future來進行非同步處理的另一個選擇
View Blog-ScaVaToScala-Scalaz-Task.md
published tags
true
ScaVaToScala
Scala
Scalaz
Programming

[ScaVa->Scala] Scalaz Task 取代Scala Future來進行非同步處理的另一個選擇

這篇同步發佈在我的BlogGist

Scala的Future用起來有什麼問題?

在Scala中,我們要處理asynchronous computations的時候應該都知道有Future這個好用的東西,但Future monad常讓我在進行error handling的時候有點困擾,我本來的回傳值若是有"成功"或"失敗"兩種case的時候,我們可以用Scalaz的disjuction或是Scalactic的Or來處理,但是加上Future後的結果會變成:

You can’t perform that action at this time.