Skip to content

Instantly share code, notes, and snippets.

@akshaydixi
akshaydixi / metize.cpp
Created April 1, 2015 20:47
Converts a unweighted graph from a webgraph(it.unimi.dsi.webgraph.ASCIIGraph) format to metis input format
#include <algorithm>
#include <boost/lexical_cast.hpp>
#include <chrono>
#include <cstdint>
#include <cstdio>
#include <ctime>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <string>
@akshaydixi
akshaydixi / hierarchialMetis
Created March 24, 2015 15:54
This python file takes as input the path to an undirected Metis edgelist and two integers (subsequent partition sizes)
#! /usr/bin/env python
from collections import defaultdict
def generateNewPartitions(partitions, partitionFilePath):
f = open(partitionFilePath , 'w')
for p in partitions[1:]:
f.write(str(p-1)+"\n")
f.close()
def createMetisInputFile(metisInput, filePath):
@akshaydixi
akshaydixi / flinkfoldWindow.scala
Created March 14, 2015 13:45
Testing foldWindow for FLINK-1450
package com.dixit.flinktrial
import java.util.concurrent.TimeUnit
import org.apache.flink.streaming.api.scala._
import org.apache.flink.streaming.api.windowing.helper.Time
object SocketTextStreamWordCount {
def main(args: Array[String]) {
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n,m,k;
n = scanner.nextInt();
m = scanner.nextInt();
k = scanner.nextInt();
@akshaydixi
akshaydixi / Main.java
Last active August 29, 2015 14:13
TOPOSORT
import java.util.*;
import java.io.*;
class Reader {
static BufferedReader reader;
static StringTokenizer tokenizer;
/** call this method to initialize reader for InputStream */
static void init(InputStream input) {
reader = new BufferedReader(
@akshaydixi
akshaydixi / Main.java
Created January 17, 2015 23:51
DCEPC701
import java.util.*;
class Node {
public int x,y,c;
public Node(int a, int b, int z) {
x = a;
y = b;
c = z;
}
public Node() {}

Keybase proof

I hereby claim:

  • I am akshaydixi on github.
  • I am akshaydixi (https://keybase.io/akshaydixi) on keybase.
  • I have a public key whose fingerprint is B64C 845D 52C7 744C 6671 F620 41DC 732C 7A75 C652

To claim this, I am signing this object:

@akshaydixi
akshaydixi / program.py
Created July 28, 2013 18:12
Program for the Applied Machine Learning Problem
from __future__ import division
import pylab as pl
from sklearn.svm import SVC
from sklearn.metrics import confusion_matrix
XFILETRAIN = 'x_train.txt'
YFILETRAIN = 'y_train.txt'
XFILETEST = 'x_test.txt'
YFILETEST = 'y_test.txt'
EPSILON = input("Epsilon: ")
@akshaydixi
akshaydixi / <controller>.php
Last active December 17, 2015 20:39
Checkin controller function for Facebook
<?php
public function checkins($person='me'){
$checkins = $this->facebook->api('/'.$person.'/?fields=posts.limit(25).fields(place,id),name');
$data=array();
$name = $checkins['name'];
for ($i=0; $i < count($checkins['posts']['data']) ; $i++) {
if(isset($checkins['posts']['data'][$i]['place'] )) {
$place_name = $checkins['posts']['data'][$i]['place']['name'];
$timestamp = $checkins['posts']['data'][$i]['created_time'];