Skip to content

Instantly share code, notes, and snippets.

import math
import random
def get_random_neighbour(state):
neighbour = [house[:] for house in state] # Deep copy
i, j = random.sample(xrange(5), 2)
attr_idx = random.randint(0, 4)
neighbour[i][attr_idx], neighbour[j][attr_idx] = neighbour[j][attr_idx], neighbour[i][attr_idx]
@teamdandelion
teamdandelion / labels_1024.tsv
Last active February 6, 2024 08:33
TensorBoard: TF Dev Summit Tutorial
We can make this file beautiful and searchable if this error is corrected: No tabs found in this TSV file in line 0.
7
2
1
0
4
1
4
9
5
9
@hcchengithub
hcchengithub / annexation.json
Last active October 29, 2021 08:50
modify the file that were just created
{"updated content":"from curl and modified "}
@parente
parente / README.md
Last active November 30, 2022 04:44
Jupyter Tidbit: Kernels for text files in JupyterLab

Summary

You can associate a Console panel and kernel with a text editor in JupyterLab, and use it to execute selected code, RStudio style.

  1. Create or open a text source file in JupyterLab.
  2. Right click in the text editor panel.
  3. Click Create Console for Editor.
  4. Select a kernel matched to the programming language you want to execute in the file.
  5. Notice the Console panel that appears.
  6. Highlight one or more lines back in the text editor you'd like to run.
@discdiver
discdiver / jupyterlab_shortcuts.md
Last active July 13, 2024 08:55
Common Jupyter Lab Keyboard Shortcuts

If you are on a Mac, substitute command for control. Don't type the + (it means press both keys at once).

Shortcuts when in either command mode (outside the cells) or edit mode (inside a cell):

  • Shift + Enter run selected cell or cells - if no cells below, insert a code cell below

  • Ctrl + B toggle hide/show left sidebar

  • Ctrl + S save and checkpoint

  • Ctrl + Shift + S save as