Skip to content

Instantly share code, notes, and snippets.

@rejuvyesh
rejuvyesh / emacss
Created April 11, 2014 09:55
script to run avaialble editor
#!/bin/zsh
eclient=$(which emacsclient)
emacs=$(which emacs)
vim=$(which vim)
name=${0:t}
if [[ $name == "emacs-gui" ]]; then
argclient=("-c" "-n")
@rejuvyesh
rejuvyesh / anonymous-gist.el
Created April 5, 2014 06:59
varible list → string ?
(dolist (mode '(magit-log-edit-mode
log-edit-mode
org-mode
text-mode
haml-mode
sass-mode
yaml-mode
haskell-mode
html-mode
nxml-mode
function [x,n] = impseq(n0,n1,n2)
% Generates x(n) = delta(n-n0); n1 <= n,n0 <= n2
% ----------------------------------------------
% [x,n] = impseq(n0,n1,n2)
%
if ((n0 < n1) | (n0 > n2) | (n1 > n2))
error('arguments must satisfy n1 <= n0 <= n2')
end
n = [n1:n2];
%x = [zeros(1,(n0-n1)), 1, zeros(1,(n2-n0))];
@rejuvyesh
rejuvyesh / lab8
Last active August 29, 2015 13:58
running cycles for bsv prediction codes
* No Pred
towers
Cycles = 19385
Insts = 9907
multiply
Cycles = 64395
Insts = 21098
@rejuvyesh
rejuvyesh / mi.m
Created April 2, 2014 19:18
Mutual information based delay estimator
function [lag, I] = mi(sig1, sig2, order, base)
% Estimate lag via Mutual Information criterion
% sig1: signal1
% sig2: signal2
% order: N order
% base: log base
start = 1;
finish = length(sig1) - order;
@rejuvyesh
rejuvyesh / gcc-phat.m
Last active November 26, 2021 15:17
gcc phat algo
for i = 1:3
tau(i) = gcc_phat(x{i}(1,:), x{i}(2,:))
end
function tau = gcc_phat(sig1, sig2)
% Find FFT for the signals
fft1 = fft(sig1, fftSize(sig1));
fft2 = fft(sig2, fftSize(sig2));
% Find R(\Tau)
G12 = fft1.*conj(fft2);
@rejuvyesh
rejuvyesh / generate.m
Last active August 29, 2015 13:57
Generate impulse response → Final signal
% Generate impulse response of the system
c = 340; % Sound speed
fs = 44100; % Sampling frequency
source = [2 3 1]; % Source positions [x y z] (m)
receiver = [4.23 3 1; 2 0.77 1]; % Receiver positions [x y z] (m)
L = [5 4 1]; % Room dimensions
beta = [0.15 0.30 0.50]; % T60 - Reverberation Time
% Modified for non-integer?
@rejuvyesh
rejuvyesh / *scratch*
Last active August 29, 2015 13:57
travis deploy
ENCRYPTION_FILTER="echo \$(echo \"- secure: \")\$(travis encrypt \"\$FILE='\`cat $FILE\`'\" -r navya/navya.github.io)"
split --bytes=100 --numeric-suffixes --suffix-length=2 --filter="$ENCRYPTION_FILTER" ~/.ssh/id_rsa_base64 id_rsa_\")"\")"
# unregister broken GHC packages. Run this a few times to resolve dependency rot in installed packages.
# ghc-pkg-clean -f cabal/dev/packages*.conf also works.
function ghc-pkg-clean() {
for p in `ghc-pkg check $* 2>&1 | grep problems | awk '{print $6}' | sed -e 's/:$//'`
do
echo unregistering $p; ghc-pkg $* unregister $p
done
}
# remove all installed GHC/cabal packages, leaving ~/.cabal binaries and docs in place.
@rejuvyesh
rejuvyesh / also
Last active December 31, 2015 01:19
>3 gem update --verbose
Updating installed gems
GET https://api.rubygems.org/specs.4.8.gz
302 Moved Temporarily
HEAD http://api.rubygems.org/specs.4.8.gz
302 Moved Temporarily
HEAD http://production.s3.rubygems.org/specs.4.8.gz
200 OK
GET http://api.rubygems.org/specs.4.8.gz
302 Moved Temporarily