Skip to content

Instantly share code, notes, and snippets.


Göktuğ Kayaalp cadadr

View GitHub Profile
cadadr / nopl.js
Created Feb 27, 2020
Non-playlist links in YouTube playlists
View nopl.js
// ==UserScript==
// @name youtube-non-playlist-links
// @version 1
// @grant none
// @namespace
// @include*
// @include*
// ==/UserScript==
cadadr /
Created Mar 23, 2020
Install (almost) all relevant -doc packages on a Debian / Ubuntu based system
# --- find and install ‘-doc’ packages related to installed packages
tmpfil="$(mktemp --tmpdir install-doc-packagesXXXXXXXXXXXXXXXXXXX)"
# This works as such:
cadadr / Readme.markdown
Last active Apr 27, 2020
Comparison of `while` and `for i in np.arange(...)` in loops of various length
View Readme.markdown

for loops with np.arange seem to be quicker than manual while loops for certain powers of 10. The inverse is true for some other numbers and interestingly, 10 million loops. I got this pattern fairly consistently with

  • Python 3.6.9
  • Linux Mint 19.3 (Linux g-X551CA 5.3.0-46-generic #38~18.04.1-Ubuntu SMP Tue Mar 31 04:17:56 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux)
  • Intel(R) Core(TM) i3-3217U CPU @ 1.80GHz
  • Numpy 1.18.2

The benchmark function is a dice roller that rolls a positive number of dice each with a positive number of sides 2+ times a batch, and calculates means for each batch. It does this by allocating nBatch * nRolls random integers between 1 and nSides * nDice (inclusive), so the run time of the function is probably consistent between runs.

View emacsconf2020.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
You can’t perform that action at this time.