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
def sinc_interp(x, s, u): | |
""" | |
Interpolates x, sampled at "s" instants | |
Output y is sampled at "u" instants ("u" for "upsampled") | |
""" | |
if len(x) != len(s): | |
raise Exception, 'x and s must be the same length' | |
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
# Written by Nadav Benedek | |
import numpy as np | |
from numba import jit, autojit | |
import scipy | |
@jit(nopython=True) | |
def approx_sinc_interp(x, s, u): | |
MAX_ELEMENTS_TO_TAKE_EACH_SIDE = 20 # Change this number to change the accuracy | |
result = np.empty(len(u)) | |
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
// Written by Nadav Benedek 2017 | |
#include "SparseConnectedComponents.h" | |
#include <iostream> | |
#include "opencv2/opencv.hpp" | |
SparseConnectedComponents::SparseConnectedComponents() { | |
} |
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
// Written by Nadav Benedek 2017 | |
class StopWatch { | |
private: | |
double accumulatedTimeSeconds = 0; | |
double startTime = 0; | |
enum State {NONE, START, PAUSE, RESUME, STOP}; | |
State state; | |
public: |
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
/*/////////////////////////////////////////////////////////////////////////////////////// | |
// | |
// NadavWatch | |
// | |
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. | |
// | |
// This software is provided by the copyright holders and contributors "as is" and | |
// any express or implied warranties, including, but not limited to, the implied | |
// warranties of merchantability and fitness for a particular purpose are disclaimed. | |
// In no event shall the Intel Corporation or contributors be liable for any direct, |
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
// We want to define a throttledExecutor an object that constructs with a number, which is delay in seconds | |
// The object has one method: invokeThrottled, that accepts a function. | |
// The object remembers the last invocation time of the function (any function) - only one number to remember. | |
// If a function wasn't executed during the last 2 seconds, execute immediately. | |
// Otherwise, wait until 2 seconds will pass and execute the function | |
// If during the wait a new invocation arrived, forget about the old pending invocation (only remember the newest). | |
class ThrottledExecutor{ | |
constructor(delayInSeconds){ | |
this.delayInSeconds = delayInSeconds; |
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
/** | |
* This wraps the extracted text segment with a parent wrapper element. | |
* If the desired text segement is spread around few nodes, than it will wrap | |
* EACH one of the nodes with the same parent wrapper. | |
* As always, the startPosition is inclusive and the endPosition is exclusive | |
* rootNode - must be a DOM element (not a jquery element) | |
*/ | |
function wrapWordSegmentWithElement(rootNode, startPosition, endPosition, emptyWrapperElement){ | |
var n, text='', walk=document.createTreeWalker(rootNode, NodeFilter.SHOW_TEXT, null, false); | |
while (n = walk.nextNode()) { |
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 | |
# By default, passenger will run your app as the user who owns the config/environment.rb or config.ru file: https://stackoverflow.com/questions/4231711/what-user-is-running-my-rails-app | |
RAILS_USER=$(stat -c '%U' /YOUR_PATH_HERE/environment.rb) | |
echo "Detected rails user: $RAILS_USER" | |
sudo -H -u $RAILS_USER bash -c 'RAILS_USER=$USER; echo "I am $USER, with uid $UID" ; echo "whoamI: $(whoami)" ; echo "Running rvm script: /home/$RAILS_USER/.rvm/scripts/rvm" ; source /home/$RAILS_USER/.rvm/scripts/rvm ; ENV_FILE=`rvm env --path` ; echo $ENV_FILE ; source $ENV_FILE ; cd /YOUR_PATH_HERE/lib/tasks ; rake XXX:YYY RAILS_ENV=production' |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<jmeterTestPlan version="1.2" properties="4.0" jmeter="4.0 r1823414"> | |
<hashTree> | |
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test" enabled="true"> | |
<stringProp name="TestPlan.comments"></stringProp> | |
<boolProp name="TestPlan.functional_mode">false</boolProp> | |
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp> | |
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true"> | |
<collectionProp name="Arguments.arguments"/> | |
</elementProp> |
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
// Invoke with prefixpath = '', stackdepth = 0, maxdepth = 5 | |
function searchObject(obj, textToSearch, prefixpath, stackdepth, maxdepth){ | |
if (stackdepth >= maxdepth) return; | |
for (var key in obj) { | |
try { | |
if (obj.hasOwnProperty(key)) { | |
if (key.includes(textToSearch)) { | |
console.log(prefixpath + "/" + key + " key is: " + (typeof key) + " " + key); | |
} |
OlderNewer