Skip to content

Instantly share code, notes, and snippets.

View vault's full-sized avatar

Michael Abed vault

  • LogRocket
  • Boston
View GitHub Profile
@vault
vault / gist:673698
Created November 12, 2010 03:45
Fuzzy Kmeans Algorithm
function [mu, C, iters, err] = fkmeansMA(X, k)
% find the centers of k clusters in the set of data X
% X is an m x n matrix of n, m-dimensional points
% k is the number of desired centers for the data
% mu is the coordinates of the centers of each cluster
% C is a vector, where each point in X, i is in cluster C(i)
% iters is the number of iterations required to converge on mu
fuzz = 3.75;
primes = {}
def prime(x):
if x in primes
return primes[x]
else
y = calculatePrime(x)
primes[x] = y
return y
@vault
vault / linux34.patch
Created August 7, 2012 04:15
Patch for Slurm on Linux 3.4
diff -aur a/src/common/jobacct_common.c b/src/common/jobacct_common.c
--- a/src/common/jobacct_common.c 2012-08-01 14:23:56.000000000 -0400
+++ b/src/common/jobacct_common.c 2012-08-06 23:48:58.400888618 -0400
@@ -39,9 +39,7 @@
* Copyright (C) 2002 The Regents of the University of California.
\*****************************************************************************/
-#if defined(__NetBSD__)
#include <sys/resource.h>
-#endif
g++ -c -O -DNDEBUG -fPIC -DESMF_LOWERCASE_SINGLEUNDERSCORE -m64 -mcmodel=small -pthread -fopenmp -I/ad/eng/support/bme-unix/scc/mgabed/cam/1/models/utils/esmf/src/Infrastructure/Mesh/src -I/ad/eng/support/bme-unix/scc/mgabed/cam/cam1/models/utils/esmf/src/Infrastructure/Mesh/src/include -I/ad/eng/support/bme-unix/scc/mgabed/cam/cam1/models/utils/esmf/build_config/Linux.gfortran.default -I/ad/eng/support/bme-unix/scgabed/cam/esmf/src/Infrastructure -I/ad/eng/support/bme-unix/scc/mgabed/cam/esmf/src/Superstructure -I/ad/eng/support/bme-unix/scc/mgabed/caam1/models/utils/esmf/src/Infrastructure/stubs/pthread -I/ad/eng/support/bme-unix/scc/mgabed/cam/esmf/src/include -I/ad/eng/support/bme-u/scc/mgabed/cam/cam1/models/utils/esmf/src/Infrastructure/stubs/mpiuni -DMPICH_IGNORE_CXX_SEEK -DESMF_NO_INTEGER_1_BYTE -DESMF_NO_INTEGER_2_E -DESMF_LAPACK=1 -DSx86_64_small=1 -DESMF_OS_Linux=1 -D__SDIR__='"src/Infrastructure/Mesh/src"' -DESMF_MPIUNI /ad/eng/support/bme-unix/scc/bed/cam/cam1/models/utils/esmf/src/Infrastru
#include <stdio.h>
void* justwait(int selector)
{
if (selector)
{
DEARGOD:
printf("%d\n", 2+2);
return NULL;
}
<style>
body {
margin: 0;
padding: 0;
}
iframe {
margin: 0;
padding: 0;
}
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE pam_mount SYSTEM "pam_mount.conf.xml.dtd">
<pam_mount>
<debug enable="1" />
<volume user="*" fstype="cifs" server="eng-home" path="%(exec userpath %(USER))" mountpoint="~" />
<mntoptions allow="nosuid,nodev,loop,encryption,fsck,nonempty,allow_root,allow_other" />
<mntoptions require="nosuid,nodev" />
<path>/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin</path>
<logout wait="0" hup="0" term="0" kill="0" />
<mkmountpoint enable="1" remove="true" />
@vault
vault / log1
Created January 29, 2013 05:27
michael on li361-142 in ~
$ /bin/cat
-bash: /bin/cat: No such file or directory
michael on li361-142 in ~
$ ls
-bash: /bin/ls: No such file or directory
michael on li361-142 in ~
#include <stdio.h>
void* justwait(int selector)
{
if (selector)
{
printf("%d\n", 1+1);
DEARGOD:
printf("%d\n", 2+2);
printf("%d\n", 3+3);
#include <stdio.h>
unsigned char return_number[] __attribute__((section (".text"))) =
{0x55, 0x48, 0x89, 0xE5, 0xB8, 255, 255,0,0, 0x5D,0xC3 };
int main()
{
int (*fn)(void);
fn = (int(*)(void))&return_number;
printf("%d\n", (*fn)());