Skip to content

Instantly share code, notes, and snippets.

View bxshi's full-sized avatar

Dash Shi bxshi

  • University of Notre Dame
  • South Bend, Indiana
View GitHub Profile
@bxshi
bxshi / test.json
Last active August 10, 2016 04:23
{
"name": "flare",
"children": [
{
"name": "analytics",
"children": [
{"name": "AgglomerativeCluster", "size": 3938},
{
"name": "cluster",
"children": [
#ifndef SOLUTION_REVERSE_CHAR_STRING
#define SOLUTION_REVERSE_CHAR_STRING
/**
* Reverse a \0 terminated char* string.
*
* Keep two pointers, one at the beginning and the other one
* at the end of this char* string. Swap the values that these
* two pointers points too, and then move them to the middle by 1.
*
#ifndef SOLUTION_UNIQUE_STR_CPP
#define SOLUTION_UNIQUE_STR_CPP
#include <string>
// Github Repository https://github.com/bxshi/interview-code/blob/master/src/CtCI5/1_1_unique_char.cpp
size_t _partition(std::string& str, size_t i, size_t j) {
size_t low = i;
size_t high = j;
@bxshi
bxshi / dblp_parser.py
Created January 27, 2015 17:04
DBLP2CSV Parser
#!/usr/bin/python3
import csv
import os
import sys
from lxml import etree
if len(sys.argv) is not 5:
print("Usage simple_parser.py dblp.xml article.csv author.csv citation.csv")
exit(1)
@bxshi
bxshi / DeltaCon.R
Last active March 22, 2024 19:02
R port of graph similarity algorithm DeltaCon
####### Please Check github.com/bxshi/rdsg for new updates, this gist will not be change in the future #######
## However, you can still use this since it is correct so far ##
# Port of original DeltaCon to R
# Baoxu(Dash) Shi
# Data Sciense Group
# University of Notre Dame
#
# Citation
# D. Koutra, J. T. Vogelstein, and C. Faloutsos:
@bxshi
bxshi / SparkListenerBug.scala
Last active August 29, 2015 14:02
SPARK-2228 NoSuchElementError, key not found
import org.apache.spark.graphx._
import org.apache.spark.{SparkConf, SparkContext}
object StackOverFlow {
def main(args: Array[String]) {
val conf = new SparkConf().setAppName("HDTM")
.setMaster("local[4]")
val sc = new SparkContext(conf)
@bxshi
bxshi / cp_rename
Created April 23, 2014 00:59
cp & rename files
#!/bin/bash
FILES="./*.txt"
DEST="/afs/dropbox"
SUFIX=".txt"
for f in $FILES
do
echo "${f:2}"
TMP=${f:2}
@bxshi
bxshi / resourceTimeoutManager.js
Created April 19, 2013 05:46
This is used for set timeout for resources
/**
* Created with JetBrains WebStorm.
* User: Baoxu Shi
* Date: 13-4-19
* Time: PM12:09
* To change this template use File | Settings | File Templates.
*/
var uuidGen = require('./uuidGenerator.js');
@bxshi
bxshi / gist:5334933
Created April 8, 2013 07:36
58_house_renting_filter
// ==UserScript==
// @name 58.com Filter
// @namespace http://use.i.E.your.homepage/
// @version 0.1
// @description For my girlfriend
// @include http://bj.58.com/hezu/*
// @copyright 2012+, You
// ==/UserScript==
//Constants
@bxshi
bxshi / web_wechat_notification_plugin.js
Last active December 11, 2015 18:09
A webkit-notification plugin for [Web WeChat](https://web.wechatapp.com/) **I only tested chrome, and if it could run on other browser, please notice me :)**
// ==UserScript==
// @name Desktop Notification 4 Web WeChat
// @namespace https://gist.github.com/4639820
// @version 1.0
// @description nothing
// @match https://web.wechatapp.com/
// @copyright 2013+, Carmack.Shi
// ==/UserScript==
var mainFunc = function () {