Skip to content

Instantly share code, notes, and snippets.

View xtang's full-sized avatar

xiaomin tang xtang

View GitHub Profile
Greptime, Inc. Contributor License Agreement
Thank you for your interest in the open source project(s) managed by Greptime, Inc. (“Greptime”). In order to clarify the intellectual property license granted with Contributions from any person or entity, Greptime must have a Contributor License Agreement (“CLA”) on file that has been signed by each contributor, indicating agreement to the license terms below. This license is for your protection as a contributor as well as the protection of Greptime and its other contributors and users; it does not change your rights to use your own Contributions for any other purpose.
By clicking “Accept” on this page You accept and agree to these terms and conditions for Your present and future Contributions submitted to Greptime. In return, Greptime shall consider Your Contributions for addition to the official Greptime open source project(s) for which they were submitted. Except for the license granted herein to Greptime and recipients of software distributed by Greptime, Yo
// borrowed from http://stackoverflow.com/questions/4006324/how-to-atomically-delete-keys-matching-a-pattern-using-redis
EVAL "return redis.call('del', unpack(redis.call('keys', ARGV[1])))" 0 bearyboard:*
redis-cli KEYS "prefix:*" | xargs redis-cli DEL
@xtang
xtang / howto.md
Created June 26, 2014 06:22 — forked from leomelzer/howto.md
  1. You have Ghostscript installed, right? Otherwise sudo apt-get install ghostscript
  2. This is important and installs the headers (iapi.h etc) which are required but don't come with the default Ghostscript package: sudo apt-get install libgs-dev
  3. I also needed sudo apt-get install gs-esp
  4. For me the pre compiled version of ImageMagick never accepted Ghostscript, so let's remove it: sudo apt-get --purge remove imagemagick
  5. Get the source of ImageMagick, untar it, cd ImageMagick-xx
  6. ./configure --with-gslib=yes [and what else you need]
  7. Confirm in the output near the bottom gslib yes yes and not gslib yes no
  8. make
  9. make install
  10. Run convert -list configure | grep DELEGATES => DELEGATES bzlib djvu freetype gs jpeg jng jp2 lcms png tiff x11 xml zlib
@xtang
xtang / brew-sync.sh
Last active August 29, 2015 13:57 — forked from jpawlowski/brew-sync.sh
#!/bin/bash
# Sync Homebrew installations between Macs via Dropbox
#
BREW="/usr/local/bin/brew"
# first get local settings
echo "Reading local settings ..."
rm -f /tmp/brew-sync.*
@xtang
xtang / API.md
Created January 30, 2013 16:12 — forked from iros/API.md

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

var QueryString = function () {
// This function is anonymous, is executed immediately and
// the return value is assigned to QueryString!
var query_string = {};
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
// If first entry with this name
if (typeof query_string[pair[0]] === "undefined") {
@xtang
xtang / gist:3957787
Created October 26, 2012 09:13
Iterator over map
Map map = new HashMap();
Iterator iter = map.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry entry = (Map.Entry) iter.next();
Object key = entry.getKey();
Object val = entry.getValue();
}
@xtang
xtang / gist:3957591
Created October 26, 2012 08:19
compile java in clojure project
find src/java -name "*.java" | xargs javac -Xlint:unchecked -encoding utf8 -cp "classes:lib/*:src/" -d classes -sourcepath src/java/
(exec-raw ["select count(*) alg from av_content where caseid = ?" [case-id]] :results)
@xtang
xtang / gist:3952180
Created October 25, 2012 11:54
Clojure: Iterate over map
(doseq [[k v] db] (prn k v))