The following instructions will redirect an SSH connection or local console to a connected serial device.
Open the Terminal app or Secure Shell extension and connect to your target system.
Someone recently asked me when an async function in JavaScript "returns". This is an interesting question because while a function like f()
below has a return
statement in it, f()
actually returns much earlier than that. To understand how this works, let's take a look at an example function. Here, a()
and c()
are normal synchronous functions and b()
is another asynchronous function.
async function f() {
a();
await b();
return c();
}
I hereby claim:
To claim this, I am signing this object:
#!/usr/bin/env python3 | |
data = b'/Td6WFoAAATm1rRGAgAhARYAAAB0L+Wj5DOY7/5dADCACGKjHBUQ5kxlhCOF794jbuifRMKAcdwGKasRB9eR7bSXYd0irz9kKxE2hOrCIs7tHNX0JlCndVief35qbaaFH0Q5FF9vEt+ErXAKnx4p1JyphVcFfLcq+YF0iUxV3AhsDQ8WTDwqyamwlFFa4mDuesJBkDuY0IBGKtS2uVF+tGLJezmIU2kFx0UqdY527cbcJ71Pv5SioaGjVOo3Psq/WN71y04Szh96bG729s7wZJOULYZctwcMe8FMEeLEDyhvOoIpYWMVhZgLSei21JDHGZEF9uk8UUKaFXwCqYIw+sKjoLr9jvRUXyic32wSJlP6ebTFOeCTI0O3J5OO1iiRhcm4gVpJTb8C40Pj25PM1oGS67UNSJwg4clcS5dj2hHc2A0hXcBkFp+Pw0oYtvIuTNXxf6chkNagkBR9L4V64NOlN3c0mcnBS93N4LWuZdAqnNbh3qiLyZ9YCbWEfmMNvlyXyT/u3gu8xkYWYe2uzgRMBI0L4VW76RRbaDHUyBi42iv2uSeTpXY73h41G9tIAi8JvdQiwdHJp60AdAXfx0wGJ3lB02wKHIY4bh7mibCZEzUQp9dG83tX1BNVKCr8j7Qj3r2IxY+g73oVmnaCk0hPlMdZa+Ol4JqxgTlryuL+X/bMz7mMxrA2/nHD2z6F8+MaYO5wuojR0BX/k1a0IDPZOmoBJEkIPawNETQ/NqFcS3SkAXpeUJVKYQd1M1FhnssrWZ9W5aWMel4qmeYreFqnW/jcVhKjyi50ifYnoHMfUZUbWggHi7vor8mADu0kdify4ak2u+24NFrGTjozKzrLCo0ptu8oCp8YLqh5lquVENhoEzfSaZbSbLMR5OjhCsQqf0S5adwQ14tq7gM9lObWk2dJlF+wGxsrZ1oQcz1RqPpirVRl9npUVEsQn+QZEMpYdx7wMLnCHtcK+ONWaIoBhz8dBkk |
class MinHeap(object): | |
def __init__(self): | |
self.a = [] | |
def insert(self, value): | |
self.a.append(value) | |
i = len(self.a) - 1 | |
parent = (i - 1) // 2 | |
while i != 0 and self.a[parent] > self.a[i]: | |
self.a[parent], self.a[i] = self.a[i], self.a[parent] |
def mergesort(a): | |
if len(a) <= 1: | |
return | |
mid = len(a) // 2 | |
b = a[:mid] | |
mergesort(b) | |
c = a[mid:] | |
mergesort(c) |
#include <malloc.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <readline/readline.h> | |
#include <readline/history.h> | |
typedef struct HashNode { | |
struct HashNode *next; | |
char *key; | |
char *value; |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <readline/readline.h> | |
#include <readline/history.h> | |
#define USE_VT100 1 | |
#if USE_VT100 | |
#define BOX_DRAWINGS_LIGHT_VERTICAL "\x1B(0\x78\x1B(B" | |
#define BOX_DRAWINGS_LIGHT_DOWN_AND_HORIZONTAL "\x1B(0\x77\x1B(B" |
import functools | |
def compute_once(f): | |
class ComputeOnce(object): | |
def __call__(self): | |
value = f() | |
self.__class__.__call__ = lambda x: value | |
return value | |
return ComputeOnce() |