Skip to content

Instantly share code, notes, and snippets.

@yassersouri
yassersouri / Default (OSX).sublime-keymap
Created March 14, 2013 06:03 — forked from idan/Default (OSX).sublime-keymap
add the 1-2 layout to sublime text. Add these files with these file names to /Users/$ACCOUNTNAME$/Library/Application\ Support/Sublime\ Text\ 3/Packages/User
[
{
"keys": ["super+alt+shift+5"],
"command": "set_layout",
"caption" : "1-2 Grid",
"args":
{
"cols": [0.0, 0.5, 1.0],
"rows": [0.0, 0.5, 1.0],
"cells":

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@yassersouri
yassersouri / flare.json
Last active December 18, 2015 14:19 — forked from mbostock/.block
{
"name": "flare",
"children": [
{
"name": "analytics",
"children": [
{
"name": "cluster",
"children": [
{"name": "AgglomerativeCluster", "size": 3938},
@yassersouri
yassersouri / How to visualize the ILSVRC mean image.md
Last active September 6, 2016 20:57
How to visualize the ILSVRC mean image

I had an issue with how to visualize the ILSVRC mean image. I just wanted to look at it and see how much does it differ from using pixel-wise mean subtraction instead of image-wise mean subtraction.

I assume that you have already downloaded the CaffeNet pretrained and model definition files.

The trick is to initialize two networks, one with mean file set (called net_mean) and the other one without mean file (called net). Then create a fake all 1 image. Use the net_mean to preprocess the fake image for data layer and save the result as fake_pre. Then use the net to deprocess fake_pre for data layer and save it as fake_re. If the two networks net and net_mean were the same then fake_re would be equal to fake, but since we have not set any mean file for net then we can visualize the mean image using 1 - fake_re. Take a look at the code.

The result looks like this:

![ILSVRC mean image](https://gist.github.com/yassersouri/f617bf7eff9172290b4f/raw/863971c47470204234017b91196b5e94a6fe

@yassersouri
yassersouri / sampler.py
Created February 19, 2018 22:35
PyTorch Sampler for Intensional Overfitting!
from torch.utils.data.sampler import Sampler
class MySampler(Sampler):
def __init__(self, main_source, indices):
self.main_source = main_source
self.indices = indices
main_source_len = len(self.main_source)
how_many = int(round(main_source_len / len(self.indices)))
@yassersouri
yassersouri / Assignments Latex Template.md
Last active November 8, 2021 03:46
Assignments Latex template.

##Assignments Latex Template

###V 0.1

I always wanted some latex template that I could use for assignments. But none of the templates I found online had all the features I wanted. So the natural next step for me was to create one.

###Notes:

  • Use with XeLaTeX
@yassersouri
yassersouri / dtft.m
Created November 27, 2012 13:05
DTFT in matlab
function [ X ] = dtft( x, n, w )
% [X] = dtft(x, n, w)
% X = DTFT values computed at w frequencies
% x = finite duration sequence over n
% n = sample position vector
% w = frequency location vector
temp = w' * n;
temp = -1i * temp;