##vimdiff commands
]c : - next difference
[c : - previous difference
do - diff obtain
dp - diff put
zo - open folded text
zc - close folded text
#!/bin/sh | |
mysql -u etherpad-lite -p etherpad-lite -e 'select store.key from store' \ | |
| grep -Eo '^pad:[^:]+' \ | |
| sed -e 's/pad://' \ | |
| sort \ | |
| uniq -c \ | |
| sort -rn \ | |
| awk '{if ($1!="2") {print $2 }}' |
function bar2(varargin) | |
%BAR2 Generalized Bar graph (Stacked, Groups, Clustered, Floating, Mixed) | |
% BAR2(X,Y) draws the columns of the M-by-N-by-Q matrix Y as N main | |
% categories with (M/2) subcategories (as default, see below) and Q | |
% simultaneous data sets with same X coordinates displayed on the | |
% same graph | |
% | |
% For MIXED charts, use input as a cell with each row containing the | |
% information for each type of chart, see example below | |
% |
import os | |
import errno | |
def make_sure_path_exists(path): | |
try: | |
os.makedirs(path) | |
except OSError as exception: | |
if exception.errno != errno.EEXIST: | |
raise |
from datetime import datetime, timedelta | |
def datetime2matlabdn(dt): | |
ord = dt.toordinal() | |
mdn = dt + timedelta(days = 366) | |
frac = (dt-datetime(dt.year,dt.month,dt.day,0,0,0)).seconds / (24.0 * 60.0 * 60.0) | |
return mdn.toordinal() + frac |
import urllib2 | |
def getpage(url): | |
""" | |
Helper function to grab web pages with urllib2 | |
returns content of the page if retrieval was successful, None otherwise | |
""" | |
req = urllib2.Request(url) | |
req.add_header('User-Agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0') |
awk '!_[$4]++' file |
temporaryBreakpointData=dbstatus('-completenames'); | |
clear functions; | |
dbstop(temporaryBreakpointData); | |
clear global; | |
clear variables; |
function fileList = getAllFiles(dirName, pattern) | |
% Example: filelistCSV = getAllFiles(somePath,'\d+_\d+_\d+\.csv'); | |
dirData = dir(dirName); %# Get the data for the current directory | |
dirIndex = [dirData.isdir]; %# Find the index for directories | |
fileList = {dirData(~dirIndex).name}'; %'# Get a list of the files | |
if ~isempty(fileList) | |
fileList = cellfun(@(x) fullfile(dirName,x),... %# Prepend path to files | |
fileList,'UniformOutput',false); | |
matchstart = regexp(fileList, pattern); |
function [h, hcb] = imagescwithnan(a, cm, nanclr, hidenan, clims) | |
% IMAGESC with NaNs assigning a specific color to NaNs | |
% Usage example: | |
% a = peaks; | |
% a(a < 0) = nan; | |
% imagescwithnan(a, hot, [0 1 1]) % [0 1 1] is cyan | |
% or | |
% imagescwithnan(a, hot, [0 1 1], true) % hide NaN color from | |
% % the colorbar | |
% or |