Skip to content

Instantly share code, notes, and snippets.

View fasiha's full-sized avatar
💭
🧘‍♂️🐻

Ahmed Fasih fasiha

💭
🧘‍♂️🐻
View GitHub Profile
@fasiha
fasiha / conv2olam.matlab
Created August 29, 2015 00:14
Fix for Luigi Rosa's “CONV2 Overlap-add Method” enabling it to convolve signals longer than 2^12. http://www.mathworks.com/matlabcentral/fileexchange/4373-conv2-overlap-add-method/
function [out] = conv2olam(a,b,mode,siz1,siz2)
%CONV2OLAM Overlap-add method of CONV2 using FFT2.
% Y = CONV2OLAM(A,B) performs the 2-D convolution of matrices
% A and B using the overlap/add method and using internal parameters (FFT2
% size and block length) which guarantee efficient execution.
% If [ma,na] = size(A) and [mb,nb] = size(B), then size(Y) = [ma+mb-1,na+nb-1].
%
%
% Y = CONV2OLAM(A,B,mode,siz1,siz2) allows you to have some control over the
% internal parameters by using a zero padding. If mode is equal to:
-- run from Terminal with:
-- $ osascript enter.scpt N
-- where N is the number of times Chrome will see "Return"
on run arg
log "Going to switch to Chrome and hit Return"
log arg
log "times"
log "Hit Control-C to cancel"
clear();
%% Parameters
% Input file
INFILE = 'ASTGTM2_N43E011_dem.tif';
% Fractional order of the texture filter, between 0 and 2
ALPHA = .5;
%% Helper functions
% Makes a vector of zero-centered Fourier frequency indexes
@fasiha
fasiha / userscript.js
Last active August 29, 2015 14:04
Show Tangorin.com's kanji stroke order in Koohii kanji study section (Chrome Tampermonkey & Firefox Greasemonkey script)
// ==UserScript==
// @name Koohii Study section stroke order
// @namespace koohiistudy
// @version 0.1
// @description Adds Tangorin kanji stroke order, and expands Sample Words
// @match http://kanji.koohii.com/study/kanji*
// @match https://kanji.koohii.com/study/kanji*
// @grant GM_xmlhttpRequest
// ==/UserScript==
@fasiha
fasiha / stylish.css
Created July 21, 2014 03:50
Stylish (Chrome extension) style to use locally-installed Kanji Stroke Order font (if available) for Koohii.com's kanji study section
/* Stylish (Chrome extension) style to use locally-installed
Kanji Stroke Order font (if available) for Koohii.com's kanji
study section */
@font-face {
font-family: 'kanjistrokeorder-local';
src:
local('KanjiStrokeOrders'),
local('KanjiStrokeOrders.ttf');
}
@fasiha
fasiha / memrise_disable_timer.js
Created July 24, 2014 12:37
Disables the Timer on watering & gardening levels in Memrise.com
// ==UserScript==
// @name Memrise Timer Disabler
// @description Disables the Timer on watering & gardening levels in Memrise.com
// @match http://www.memrise.com/course/*/garden/*
// @version 0.1.1
// @updateURL https://userscripts.org/scripts/source/174879.meta.js
// @downloadURL https://userscripts.org/scripts/source/174879.user.js
// @grant none
// ==/UserScript==
/* Clear background image */
body.memrise.fullscreen.garden {
background-size:100%;
background-repeat:no-repeat;
}
/* Put a huge gap between the questions and answers to avoid contamination */
.typing-wrapper, ol.choices { margin-top: 34em !important; }
/* Use Japanese fonts. Sorry Chinese learners. */
@fasiha
fasiha / README.md
Last active August 29, 2015 14:05
Component analysis of the 2200 kanji in Heisig's Remembering the Kanji using the KanjiVG database

Component graph

This component graph shouldn't be confused for a dependency graph; it is rather an inverse of that. It shows, for each of the 2200 kanji, which kanji reference it in their KanjiVG descriptors. The first kanji per line is a dependency of all the kanji that follow it on that line.

Leaf nodes

The list of 1670 kanji is the subset of the total list of 2200 Remembering the Kanji, Volume 1 (6th edition) kanji that are not referenced in the KanjiVG descriptors for those 2200 kanji.

@fasiha
fasiha / README.md
Last active August 29, 2015 14:05
D3.js: 2D matrix to 3D nested lists: an elaboration of Mike Bostock's table example using lists

Based on https://github.com/mbostock/d3/wiki/Selections#Data where a 2D matrix is used to produce a table. Here we use it to produce a 3-deep nested HTML list, showing that the technique works when chaining "ul > li" tags and when making up new data based on individual elements of the original matrix.

Produces

  • Row 0
    • 11975
      • 11975
      • 1197.5
      • 119.75
  • 5871
@fasiha
fasiha / snippet__print_due_cards.py
Created September 3, 2014 14:06
Snippet for running in the Anki Debug Window (Control+:, i.e., Control colon): print out all due cards' questions
# How many cards to print?
cardsToPrint = 250
# By default, the Anki scheduler will just show you 50 cards due. Where does it get off???
mw.col.sched.queueLimit = cardsToPrint + 1
# Don't print cards that have already been printed: this will store card IDs as we print them
seen = {}
# Let's do this!!!