This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct OBJECT{ // The object to be serialized / deserialized | |
public: | |
// Members are serialized / deserialized in the order they are declared. Can use bitpacking as well. | |
DATATYPE member1; | |
DATATYPE member2; | |
DATATYPE member3; | |
DATATYPE member4; | |
}; | |
void write(const std::string& file_name, OBJECT& data) // Writes the given OBJECT data to the given file name. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'''Implementation and of K Means Clustering | |
Requires : python 2.7.x, Numpy 1.7.1+''' | |
import numpy as np | |
def kMeans(X, K, maxIters = 10, plot_progress = None): | |
centroids = X[np.random.choice(np.arange(len(X)), K), :] | |
for i in range(maxIters): | |
# Cluster Assignment step | |
C = np.array([np.argmin([np.dot(x_i-y_k, x_i-y_k) for y_k in centroids]) for x_i in X]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
MIT License | |
Copyright (c) 2017 Cyrille Rossant | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.FileInputStream; | |
import java.io.FileNotFoundException; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.util.zip.ZipEntry; | |
import java.util.zip.ZipFile; | |
class AndroidXMLDecompress { | |
// decompressXML -- Parse the 'compressed' binary form of Android XML docs | |
// such as for AndroidManifest.xml in .apk files |