Skip to content

Instantly share code, notes, and snippets.

Srinivas Gorur-Shandilya sg-s

Block or report user

Report or block sg-s

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View DNS servers
Alternate DNS
198.101.242.72
23.253.163.53
BlockAid Public DNS (or PeerDNS)
205.204.88.60
178.21.23.150
Censurfridns
91.239.100.100
@sg-s
sg-s / matlab-data-saving.md
Created Sep 29, 2016
A note on saving data in MATLAB
View matlab-data-saving.md

The problem

We want to save data as it is generated, and to save it as a .mat file. Since every trial can be of a different length, a simple matrix will not suffice.

We have the following two options:

cell_data.x{1} = randn(1e4,1);
cell_data.y{1} = randn(1e4,1);
@sg-s
sg-s / automatic-version-numbers.md
Last active Jan 9, 2020
Automatic version numbers of your git repository using git hooks
View automatic-version-numbers.md

Put this in a file called pre-commit in .git/hooks/

#!/bin/sh
# To enable this hook, rename this file to "pre-commit".

git log master --pretty=oneline | wc -l > build_number
git add build_number
@sg-s
sg-s / frozen-random.md
Last active Aug 29, 2015
One line frozen noise generator in MATLAB
View frozen-random.md
RandStream.setGlobalStream(RandStream('mt19937ar','Seed',1984)); 

sets the randsom stream to a particular state. (1984 because this is the most True state). Make sure you run this before every invocation of rand:

>> RandStream.setGlobalStream(RandStream('mt19937ar','Seed',1984)); 
>> rand(3)
ans =
@sg-s
sg-s / browsing.md
Last active Dec 21, 2015 — forked from atcuno/gist:3425484ac5cce5298932
HowTo: Privacy & Security Conscious Browsing
View browsing.md

The purpose of this document is to make recommendations on how to browse in a privacy and security conscious manner. This information is compiled from a number of sources, which are referenced throughout the document, as well as my own experiences with the described technologies.

I welcome contributions and comments on the information contained. Please see the "How to Contribute" section for information on contributing your own knowledge.

Table of Contents

@sg-s
sg-s / MATLAB-name-value
Last active Jul 14, 2017
MATLAB name value pair parsing
View MATLAB-name-value
% options and defaults
options.foo = 1;
options.bar = 2;
if nargout && ~nargin
varargout{1} = options;
return
end
% validate and accept options
View keybase.md

Keybase proof

I hereby claim:

  • I am sg-s on github.
  • I am srinivas (https://keybase.io/srinivas) on keybase.
  • I have a public key whose fingerprint is 88C6 D016 6B09 8880 6BF8 F253 8C9C B698 D193 4604

To claim this, I am signing this object:

@sg-s
sg-s / cron-see-path
Created Dec 11, 2014
How to get cron to see the $PATH you see
View cron-see-path
echo PATH=$PATH > tmp.cron
echo >> tmp.cron
crontab -l >> tmp.cron
crontab tmp.cron
@sg-s
sg-s / gist:c36ce3e8063a155b7732
Last active Aug 29, 2015
Quickly check if you have internet access
View gist:c36ce3e8063a155b7732
ping -t 1 -q google.com | grep "0.0% packet loss" | wc -l

returns 1 for internet, 0 for no internet

@sg-s
sg-s / the-bash-guide.md
Last active Dec 21, 2015
A collection of various bash tips and tricks collected from various sources.
View the-bash-guide.md

The Bash Guide

A collection of various bash tips and tricks collected from various sources. I'm writing this as I learn new stuff, so this is in no way authoritative or even corrent. In fact, you shouldn't read this.

Basics

Version, updates and installation

Check your version:

You can’t perform that action at this time.