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
#!/bin/bash | |
# Get the substring to replace and the replacement string | |
read -p "Enter substring to replace: " old_string | |
read -p "Enter replacement string: " new_string | |
# Function to rename files recursively | |
rename_files () { | |
for filename in *; do | |
# Check if filename contains the old string |
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
# -*- coding: utf-8 -*- | |
""" | |
SCAN: A Structural Clustering Algorithm for Networks | |
As described in http://ualr.edu/nxyuruk/publications/kdd07.pdf | |
""" | |
from collections import deque | |
import numpy as np | |
from scipy.sparse import csr_matrix |
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
#ifndef TIMEVAL_TO_TIMESPEC | |
#define TIMEVAL_TO_TIMESPEC(tv, ts) \ | |
do { \ | |
(ts)->tv_sec = (tv)->tv_sec; \ | |
(ts)->tv_nsec = (tv)->tv_usec * 1000; \ | |
} while (0) | |
#endif | |
#ifndef TIMESPEC_TO_TIMEVAL | |
#define TIMESPEC_TO_TIMEVAL(tv, ts) \ | |
do { \ |
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 os | |
import jpype | |
from neo4j import GraphDatabase | |
from flask import Flask, request, session, g, redirect, url_for, abort, render_template, flash | |
app = Flask(__name__) | |
app.config.from_object(__name__) | |
app.config['ADMIN'] ='Matthew' | |
app.config['DATABASE']='/tmp/graphtest' |
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
// Immer | |
// ... | |
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e=e||self).immer={})}(this,function(e){"use strict";var r,t="undefined"!=typeof Symbol?Symbol("immer-nothing"):((r={})["immer-nothing"]=!0,r),n="undefined"!=typeof Symbol&&Symbol.for?Symbol.for("immer-draftable"):"__$immer_draftable",o="undefined"!=typeof Symbol&&Symbol.for?Symbol.for("immer-state"):"__$immer_state";function i(e){return!!e&&!!e[o]}function a(e){return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e))return!0;var r=Object.getPrototypeOf(e);return!r||r===Object.prototype}(e)||!!e[n]||!!e.constructor[n])}var f=Object.assign||function(e,r){for(var t in r)l(r,t)&&(e[t]=r[t]);return e},s="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function c(e,r){ |
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
// our simple example to play with | |
let island = [ | |
[1, 1, 0, 0, 0], | |
[0, 1, 0, 0, 1], | |
[1, 0, 0, 1, 1], | |
[0, 0, 0, 0, 0], | |
[1, 0, 1, 0, 1] | |
]; |
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
ffmpeg -i my-movie.mov -ss 00:00:00 -filter_complex "[0:v] fps=12,scale=1024:-1,split [a][b];[a] palettegen [p];[b][p] paletteuse" output.gif |
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
func withTimeout(ctx context.Context, f func(context.Context) error) error { | |
c := make(chan error, 1) | |
go func() { c <- f(ctx) }() | |
select { | |
case <-ctx.Done(): | |
return ctx.Err() | |
case err := <-c: | |
return err | |
} |
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
#!/bin/bash | |
# Exit immediately for non zero status | |
set -e | |
# Check unset variables | |
set -u | |
# Print commands | |
set -x | |
# Prevent acciedently running as root |
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
from __future__ import print_function | |
import numpy as np | |
import cv2 | |
import time | |
np.set_printoptions(formatter={'float': '{: 0.3f}'.format}) | |
def triangulate_nviews(P, ip): | |
""" |
NewerOlder