Skip to content

Instantly share code, notes, and snippets.

View wusuopubupt's full-sized avatar

Dash Wang wusuopubupt

View GitHub Profile
@wusuopubupt
wusuopubupt / get_sql_context_by_dataframe.py
Created June 27, 2017 06:50
get sql context by dataframe
from pyspark.sql import SQLContext
sqlContext = SQLContext.getOrCreate(t1.rdd.context)
@wusuopubupt
wusuopubupt / batch-kill-yarn-app.sh
Created June 23, 2017 08:50
batch mode to kill yarn applications
#!/bin/bash
yarn application -list | awk '{print $1}' | while read line;do
echo $line
yarn application -kill $line
done
@wusuopubupt
wusuopubupt / delete_merged_branch.sh
Created June 23, 2017 07:19
delete git branches which have already been merged
git branch --merged | egrep -v "(^\*|master|dev)" | xargs git branch -d
#include<string>
#include<vector>
#include<sstream>
#include<iostream>
std::vector<std::string> split(const std::string& s, char delimiter) {
std::string item;
std::istringstream is(s);
std::vector<std::string> ret;
while(std::getline(is, item, delimiter)) {
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main (void)
{
char *string = "T01:91+:123";
char tmp[16];
char* s;
section {
padding-top: 60px;
}
.subnav {
margin-bottom: 60px;
width: 100%;
height: 36px;
background-color: #eeeeee; /* Old browsers */
background-repeat: repeat-x; /* Repeat the gradient */
@wusuopubupt
wusuopubupt / gist:8109683
Created December 24, 2013 06:55
Reverse a string in a pythonic way~
'hello world'[::-1]
#'dlrow olleh'
#http://stackoverflow.com/questions/931092/reverse-a-string-in-python
@wusuopubupt
wusuopubupt / answers.md
Created December 23, 2013 08:19 — forked from jpsim/answers.md
  1. Plain Strings (207): foo
  2. Anchors (208): k$
  3. Ranges (202): ^[a-f]*$
  4. Backrefs (201): (...).*\1
  5. Abba (169): ^(.(?!(ll|ss|mm|rr|tt|ff|cc|bb)))*$|^n|ef
  6. A man, a plan (177): ^(.)[^p].*\1$
  7. Prime (286): ^(?!(..+)\1+$)
  8. Four (199): (.)(.\1){3}
  9. Order (198): ^[^o].....?$
  10. Triples (507): (^39|^44)|(^([0369]|([147][0369]*[258])|(([258]|[147][0369]*[147])([0369]*|[258][0369]*[147])([147]|[258][0369]*[258])))*$)
public class TestConSum {
public static void main(String... args) {
int[] arr = new int[]{-2,11,-4,13,-5,-2};
int negsum = 0;
int maxsum = 0;
for (int i = 0; i < arr.length; i++) {
if (arr[i] < 0) {