Skip to content

Instantly share code, notes, and snippets.

@amici-fos
amici-fos / ford_fulkerson.c
Created February 5, 2017 07:04
Ford Fulkerson algorithm in C
#include "queue.h"
#include <stdio.h>
#include "geometry.h"
#define MAXV 100 /* the Maximum number of vertices */
#define MAXDEGREE 50 /* maximum outdegree for the vertex*/
typedef struct {
int v; /* neighboring vertex */
int capacity; /* capacity of edge */
int flow; /* flow through edge */
int residual; /* residual capacity of edge */
#include "queue.h"
#include <stdio.h>
#include "geometry.h"
#define MAXV 100 /* the Maximum number of vertices */
#define MAXDEGREE 50 /* maximum outdegree for the vertex*/
@amici-fos
amici-fos / export path ( Linux)
Created November 20, 2016 05:40
make executable available
PATH=$PATH:/data/myscripts
export PATH
// clear the screen for testing
document.body.innerHTML = '';
var nums = [1,2,3];
// Let's loop over the numbers in our array
for (var i = 0; i < nums.length; i++) {
// This is the number we're on...
var num = nums[i];
// clear the screen for testing
document.body.innerHTML = '';
var nums = [1,2,3];
// Let's loop over the numbers in our array
for (var i = 0; i < nums.length; i++) {
// This is the number we're on...
var num = nums[i];
function UploadFile(file) {
var xhr = new XMLHttpRequest();
xhr.upload.addEventListener("progress", function(e) {
var pc = parseInt((e.loaded / e.total * 100));
document.getElementById("progressbar").value= pc;
document.getElementById("progressbarstatus").innerHTML= pc +"% upload done";
}, false);
xhr.onreadystatechange = function(e) {
if (xhr.readyState ==200) {
console.log(e);
function ajaxUpload(a){
files=a.files[0];//get file
formdata=new FormData(); // created http transport object
formdata.append("files",files) ;// append a new value and this is going to send as post
ajax=new XMLHttpRequest();
ajax.upload.addEventListener("progress",console.log(1),false)
ajax.open("POST","manage.php/upload");
ajax.send(formdata);
function progressHandler(e){
console.log(e.loaded/e.total);
$("a.mainlink").each(function(){
k=$(this).attr("href");m="https://www.amicicorp.net"+location.pathname;
if(k==m){$(this).parent().addClass('active2');}
})
$("input[name='options']").on("click",function(){
$(".active").each(function(){
$(this).removeClass("active");
});
$(this).parent().addClass("active");
if ($( ".subtabs" )){
$( window ).scroll(function() {
var p = $( ".subtabs" );
var offset = p.offset();
var viewableOffset = p.offset().top - $(window).scrollTop();
console.log($(window).scrollTop());
if(viewableOffset<=20){
p.addClass("fixed");
}
if ($(window).scrollTop()<60){