Skip to content

Instantly share code, notes, and snippets.

View chanana's full-sized avatar
:octocat:

Shaurya Chanana chanana

:octocat:
View GitHub Profile

The Illustrated Transformer is fantastic, but I would suggest that those going into it really should read the previous articles in the series to get a foundation to understand it more, plus later articles that go into GPT and BERT, here's the list:

@chanana
chanana / black_in_jupyter.md
Created June 21, 2022 13:24
How to use black in `jupyter` notebooks
  1. Install the GUI extensions module

  2. Go to the Nbextensions tab in your jupyter notebook

  3. Tick code prettify image

  4. Paste the following in the json folding to enable black instead of whatever it’s set to:

{
  "python": {
    "library": "import json\ndef black_reformat(cell_text):\n    import black\n    import re\n    cell_text = re.sub('^%', '#%#', cell_text, flags=re.M)\n    try:\n        reformated_text = black.format_str(cell_text, 88)\n    except TypeError:\n        reformated_text = black.format_str(cell_text, mode=black.FileMode(line_length=88))\n    return re.sub('^#%#', '%', reformated_text, flags=re.M)",
@chanana
chanana / gist:a8aefc9b00949d63b1a013607d045562
Last active December 10, 2018 23:06 — forked from dedy-purwanto/gist:11312110
Bulk remove iTerm2 color schemes.
# iTerm2 saves it's preferences in ~/Library/Preferences/com.googlecode.iterm2.plist in a binary format
# What you need to do is basically copy that somewhere, convert to xml and remove color schemes in the xml files.
$ cd /tmp/
$ cp ~/Library/Preferences/com.googlecode.iterm2.plist .
$ plutil -convert xml1 com.googlecode.iterm2.plist
$ vi com.googlecode.iterm2.plist
# Now remove the color schemes in the <key> and <dict> tags,
# to make it easier, record a macro in vi to remove the key (e.g: Desert/Solarized) using `dd`,
# and then remove its color dict with `dat` (delete around tag), and repeat the macro until