| Action | Sublime | VSCode | PyCharm |
|---|---|---|---|
| Select next occurrence | Cmd + D | Cmd + D | Alt + J |
| Select all occurrences | Control + Cmd + G | ||
| Break selection into one cursor per line | Cmd + Shift + L | Shift + Option + I | Option + Mouse selection |
This file contains hidden or 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 functools | |
| import time | |
| def retry(max_retries=3, delay_s=2): | |
| def decorator(func): | |
| @functools.wraps(func) | |
| def wrapper(*args, **kwargs): | |
| retries = max_retries | |
| while retries > 0: | |
| try: |
This file contains hidden or 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
| def synchronized(func): | |
| """Wraps a function with a threading lock.""" | |
| lock = threading.Lock() | |
| def wrapper(*args, **kwargs): | |
| with lock: | |
| return func(*args, **kwargs) | |
| return wrapper |
This file contains hidden or 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
| const allowedChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=_" | |
| const examples = [ | |
| "1010AAAAAAAAAAAAX_oX_oX_oX_oX_oFmUAAAaqQX_oZD4X_oTMgTMgJmQX_oZU8AAAEzIZD4OZYOZYTMgJmQFmUEzIX_oFVQEzIX_oEzIOZYTMgAAAEzIZgUZgUEzIZrsX_oaN0EzIAAAAAAEzIakkaCcEzIZJkEzIEzIJmQAAAOZYEzIX_oFmUEzIX_oX_oFVQJmQAAAOZYZU8a7UEzIAAATMgZD4TMgAAAAAAX_oX_oTMgEzIAAATMgX_oX_oAAAAAAZU8TMgTMgAAAAAAAAAFVQX_oX_oX_oX_oAAAAAAAAA", | |
| "1010AAAAAAEzIEzIX_oX_oX_oX_oX_oAAAAAAZrsaN0X_oX_oJmQTMgFmUX_oAAAAAAZJkEzIEzITMgTMgJmQX_oX_oAAAAAAX_oEzIFVQTMgOZYEzIZU8EzIEzIAAAX_oaqQEzIOZYTMgEzIX_oZU8EzIAAAAAAX_oZD4JmQOZYTMgFmUX_oZU8EzIFVQEzIX_oOZYTMgTMgEzIX_oEzIEzIX_oZD4X_oOZYTMgEzIEzIakkFmUEzIZD4OZYOZYTMgTMgX_oZgUaCcEzIEzIOZYOZYTMgTMgJmQa7UEzIEzIEzI", | |
| "2010AAAAAAAAAAAAAAAAAAAAAEzIEzIAAAAAAAAAEzIFmUAAAAAAEzIEzIAAAAAAAAAEzIFVQEzIAAAEzIEzIEzIFVQTMgTMgX_oX_oX_oX_oX_oZgUX_oEzIAAAAAAAAAEzIEzIEzIEzIEzIZD4X_oX_oX_oX_oTMgJmQX_oJmQEzIaCcEzIFmUAAAEzIEzIZD4ZD4X_oX_obMYOZYTMgTMgTMgJmQEzIZU8ZgUX_oakkEzIOZYAAAEzIaN0X_oEzIFVQZD4OZYOZYOZYTMgTMgEzIFmUEzIEzI |
This file contains hidden or 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
| const TIME_MIN = new Date('2020-10-27'); | |
| const CAL_ID = 'simssosdenk@gmail.com'; | |
| const QUERIES = ['violin lesson', 'violin practice']; | |
| const RESULT_BATCH_SIZE = 40; | |
| // App Script console testing endpoint | |
| function main() { | |
| loadWeeklyPracticeTime().forEach(x => console.log(x)); | |
| } |
This file contains hidden or 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/bash | |
| set -euo pipefail | |
| IFS=$'\n\t' | |
| timestamp=$(date +%s) | |
| ip=192.168.1.102 | |
| echo "Taking a photo..." | |
| ssh pi@$ip "mkdir -p cam && cd cam && raspistill -o cam-$timestamp.jpg" |
This file contains hidden or 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 tensorflow as tf | |
| def vec_lookup_in_mat(mat: tf.Tensor, vec: tf.Tensor): | |
| """ | |
| Performs a lookup of values in the matrix rows using the indices stored in the vector. | |
| For example, given the matrix [[1, 2, 3], [4, 5, 6]] and the vector [0, 2], the function would return a vector | |
| consisting of the entry with index zero in the first row and index 2 in the second row, i.e. [0, 6]. | |
| :param mat: Tensor of shape [m, n, ...], values will be looked up from it; dtype any | |
| :param vec: Tensor of shape [m], indices for each row of the matrix; dtype int32 |
This file contains hidden or 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
| // library imports | |
| #define SERIAL_DEBUG | |
| // global variables | |
| void setup() { | |
| #ifdef SERIAL_DEBUG | |
| Serial.begin(9600); | |
| Serial.println("Initializing..."); |
This file contains hidden or 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
| \documentclass[a4paper]{article} | |
| \usepackage[utf8]{inputenc} | |
| % math | |
| \usepackage{amsmath} | |
| \usepackage{amssymb} % special set sybmols e.g. for real numbers R | |
| \usepackage{bm} % bold math | |
| \usepackage{isomath} | |
| % bracket fix (see https://tex.stackexchange.com/questions/2607) |
This file contains hidden or 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
| acc = tf.reduce_mean(tf.cast(tf.equal(tf.argmax(softmax, axis=1), tf.cast(labels, tf.int64)), 'float'), name='acc') |
NewerOlder