Skip to content

Instantly share code, notes, and snippets.

@richard1122
richard1122 / gets_between.php
Created October 5, 2014 12:21
gets_between
/*
This function split a string into multi part, each part start with(exclude) $start and end with(exclude) $end.
$end is optional.
Thanks @zenozeng for backend code at QSC mobile. (function get_between)
*/
function gets_between($start, $end, $content) {
$r = explode($start, $content);
$arr = array();
@richard1122
richard1122 / nsd.java
Last active April 5, 2023 08:00
A simple example for Android NSD(network service discovery) and server socket
package com.richard1993.android.inputhack;
import android.app.Service;
import android.content.Intent;
import android.net.nsd.NsdManager;
import android.net.nsd.NsdServiceInfo;
import android.os.IBinder;
import android.util.Log;
import java.io.BufferedInputStream;
@richard1122
richard1122 / svgToPNG.sh
Last active August 29, 2015 14:05
Convert some svg into png by inkscape
for line in `find . -iname '*.svg';`
do
for dpi in 90 180 360 720
do
inkscape -z -f "${line}" --export-png="png/${line}_${dpi}.png" -d "${dpi}"
done
done