Skip to content

Instantly share code, notes, and snippets.

View nickhsu's full-sized avatar

Nick Hsu nickhsu

  • Taiwan
View GitHub Profile
@nickhsu
nickhsu / es.sh
Last active January 1, 2016 06:49 — forked from rajraj/es.sh
cd ~
sudo yum update
sudo yum install java-1.7.0-openjdk.i686 -y
wget http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.5.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
@nickhsu
nickhsu / gist:73166d4e94179ce7ec97e8c8312c41d7
Created November 18, 2016 08:29 — forked from brentsimmons/gist:5810992
Detect a tap on a URL inside a UITextView.Note: the rs_links method isn't included -- you'll need something that takes text and returns an array of detected links. This gist just demonstrates walking through the UITextView characters.
#import "UITextView+RSExtras.h"
@implementation UITextView (RSExtras)
static BOOL stringCharacterIsAllowedAsPartOfLink(NSString *s) {
/*[s length] is assumed to be 0 or 1. s may be nil.
Totally not a strict check.*/
if (s == nil || [s length] < 1) {
@nickhsu
nickhsu / convert-to-webp.sh
Last active December 9, 2016 04:34 — forked from SandroMachado/convert-to-webp.sh
Script to convert all the `JPEG` images to the `WEBP` format in your Android project
#/bin/sh
# Inpiration: http://engineeringblog.yelp.com/2016/05/yelp-android-app-went-on-a-diet.html
# `-lossless` not used to give support for Android 4.0+
# Make sure cwebp is installed.
if ! type "cwebp" > /dev/null; then
echo "Please install cwebp to continue:"
echo "brew install webp"
exit 1
fi
@nickhsu
nickhsu / sslocal
Created December 19, 2016 03:29 — forked from Jimmy-Xu/sslocal
/etc/init.d/sslocal
#!/bin/bash
set -e
### BEGIN INIT INFO
# Provides: sslocal
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog $remote_fs
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5