Skip to content

Instantly share code, notes, and snippets.

View JavierJia's full-sized avatar

Jianfeng Jia JavierJia

View GitHub Profile
year="2016"
month="01"
d="${year}-${month}-01"
till=$(date -I -d "$d + 1 month")
while [ "$d" != "$till" ]; do
echo $d
n=$(date -I -d "$d + 1 day")
@JavierJia
JavierJia / cancel.sh
Last active April 14, 2017 22:03
query Asterixdb by setting client_context_id and cancel it using that id
curl -v -XDELETE http://uranium.ics.uci.edu:19002/admin/requests/running?client_context_id=1
@JavierJia
JavierJia / histogram.plot
Created April 10, 2017 18:42
gnuplot histogram and normal distribution
set key left box
set autoscale
set samples 800
set terminal postscript eps enhanced size 3in,3in color
set x2range [-10 : 8]
set ytics nomirror
set y2tics
set autoscale y
drop dataverse twitter if exists;
create dataverse twitter if not exists;
use dataverse twitter
create type typeUser if not exists as open {
id: int64,
name: string,
screen_name : string,
lang : string,
location: string,
@JavierJia
JavierJia / fileFeed.sh
Last active April 6, 2017 18:32
reingest data to AsterixDB
#!/usr/bin/env bash
sbt "project noah" "run-main edu.uci.ics.cloudberry.noah.feed.FileFeedDriver \
-u 128.195.52.79 -p 10001 "
@JavierJia
JavierJia / curlBerry.sh
Created January 6, 2017 09:44
Query to cloudberry directly
cat <<EOF | curl -XPOST -d @- --header "Content-Type:application/json" http://localhost:9000/berry
{
"dataset": "twitter.ds_tweet",
"group": {
"by": [
{
"field": "create_at",
"apply": {
"name": "interval",
"args" : {
@JavierJia
JavierJia / interesting.aql
Created November 21, 2016 07:03
Find interesting hashtags in AQL
for $z in (
for $x in (
for $t in dataset twitter.ds_tweet
where $t.create_at > datetime('2016-08-01T00:00:00.000Z')
where not(is-null($t.'hashtags'))
for $unnest0 in $t.'hashtags'
let $taggr := $t
group by $g0 := $unnest0, $g1 := get-interval-start-datetime(interval-bin($t.'create_at', datetime('1990-01-01T00:00:00.000Z'), day-time-duration("P1D") )) with $taggr
return { 'tag' : $g0, 'day' : $g1,'count' : count($taggr) }
)
@JavierJia
JavierJia / docker-rm-vms.sh
Created October 28, 2016 21:07
docker remove dangling volumns
docker volume rm `docker volume ls -f dangling=true | tail -n+2 | gawk '{print $2}' | xargs `
<!--
! Licensed to the Apache Software Foundation (ASF) under one
! or more contributor license agreements. See the NOTICE file
! distributed with this work for additional information
! regarding copyright ownership. The ASF licenses this file
! to you under the Apache License, Version 2.0 (the
! "License"); you may not use this file except in compliance
! with the License. You may obtain a copy of the License at
!
! http://www.apache.org/licenses/LICENSE-2.0
time cat <<'EOF' | curl -XPOST --data-binary @- http://uranium.ics.uci.edu:19002/aql
use dataverse twitter;
drop feed TweetFeed if exists;
drop feed MessageFeed if exists;
create feed TweetFeed using socket_adapter
(
("sockets"="ur_ur:10001"),
("address-type"="nc"),
("type-name"="typeTweet"),