This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
array_chunk =: ((%~#),[)$] | |
NB. Test #1 | |
input =: 1 2 3 4 5 6 | |
expected =: 3 2 $ input | |
result =: 2 array_chunk input | |
assert result = expected | |
NB. Test #2 | |
input =: 1 2 3 4 5 6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import string | |
def rands(length): | |
""" return a random string of given length composed of letters and digits """ | |
return ''.join(random.choice(string.letters+string.digits) for _ in range(length)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var x = [ | |
{ mykey: 'mykey1', myvalue: 'myvalue1' }, | |
{ mykey: 'mykey2', myvalue: 'myvalue2' } | |
] | |
var array = x.reduce((o, c) => Object.defineProperty(o, c.mykey, {value: c.myvalue}), {}) | |
// result: array = { mykey1: myvalue1, mykey2: myvalue2 } | |
// 60 bytes: x.reduce((o,c)=>Object.defineProperty(o,c.k,{value:c.v}),{}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; | |
var d = window.prompt("Please enter the name of the directory you want to download", document.querySelector("#uploader>h1").attributes["data-path"].value); | |
var r = window.indexedDB.open("/localStorage"); | |
var saveData = (function() { | |
var a = document.createElement("a"); | |
document.body.appendChild(a); | |
a.style = "display: none"; | |
return function(data, fileName) { | |
var blob = new Blob([data], { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kvffile = 'output/example.kvf'; | |
texfile = 'output/example.tex'; | |
diary(kvffile); | |
disp(['value1 = ' num2str(value1)]); | |
disp(['value2 = ' num2str(value2)]); | |
disp(['value3 = ' num2str(value3)]); | |
diary off; | |
fclose('all'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function kvf2tex2( kvf, fout, rootkey) | |
%KVF2TEX2 | |
if nargin > 1 | |
rootkey = [rootkey '.']; | |
else | |
rootkey = ''; | |
end | |
TEMPLATE = '\\@lookupPut{%s%s}{%s}\n'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% | |
% Copyright 2017 Arthur Gay | |
% | |
% Permission is hereby granted, free of charge, to any person obtaining a copy | |
% of this software and associated documentation files (the "Software"), to deal | |
% in the Software without restriction, including without limitation the rights | |
% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
% copies of the Software, and to permit persons to whom the Software is | |
% furnished to do so, subject to the following conditions: | |
% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\makeatletter | |
\newcommand{\get}[1]{% | |
\@ifundefined{lookup@#1}{% | |
\PackageError{lookup}{No #1 key in lookup}{% | |
Key #1 was not found in lookup. % | |
You can insert it with \string\lookupPut{key}{value}.% | |
}% | |
}{% | |
\@nameuse{lookup@#1}% | |
}% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% >Show a link to a video. | |
% | |
% (c) Arthur Gay | |
% | |
%% This program can be redistributed and/or modified under the terms | |
%% of the LaTeX Project Public License Distributed from CTAN archives | |
%% in directory macros/latex/base/lppl.txt. | |
% | |
\NeedsTeXFormat{LaTeX2e}[1994/06/01] | |
\ProvidesPackage{videos} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -e | |
USAGE="Usage: $0 [OPTIONS]... | |
Install the requirements for the dronecourse. | |
Options: | |
-f ignore recommended system warning | |
-h show this message and exit | |
" |
OlderNewer