Skip to content

Instantly share code, notes, and snippets.

@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_\")"\")"
@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 / 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 / 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
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 / 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
@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")
# 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 / xmobarrc
Created April 16, 2014 18:17
xmobarrc
Config { font = "xft:Consolas-8"
, bgColor = "#121212"
, fgColor = "#AFAF87"
, position = BottomW L 96
, lowerOnStart = True
, commands = [ Run DynNetwork ["-t", "<dev> <fc=#387BAB><icon=/home/rejuvyesh/.xmonad/icons/net_down_03.xbm/><rx>kB</fc> <fc=#005F87><icon=/home/rejuvyesh/.xmonad/icons/net_up_03.xbm/><tx>kB</fc>", "-M", "5"] 15
, Run Date "%a %d-%m %H:%M:%S " "date" 10
, Run BatteryP ["BAT0"] ["-t", "<fc=#D0CFD0><acstatus></fc><left>", "-S", "True", "-L", "30", "-H", "70", "-p", "3", "-l", "#D74083", "-n", "#FF9926", "-h", "#93FF19", "--", "-O", "+", "-o", "-", "-f", "BAT0/subsystem/ADP0/online" ] 600
, Run StdinReader
, Run Memory ["-p", "2", "-c", "0", "-S", "True","-H", "80", "-h", "#D7005F", "-L", "50", "-l", "#87FF00", "-n", "#FF8700", "-t", "RAM: <usedratio>"] 50
@rejuvyesh
rejuvyesh / cabal2pkgbuild
Created April 17, 2014 10:44
automate habs a little
#!/usr/bin/env zsh
# Created by rejuvyesh <mail@rejuvesh.com>
usage="Usage: ./cabal2pkgbuild <HACKAGE_PACKAGES_FILE>"
if [[ -z $1 ]]; then
echo $usage
exit 1
fi