Skip to content

Instantly share code, notes, and snippets.

Scratchpad

append

Implement append in Scheme, TypeScript, Python, and Kotlin

Here is an implementation of the append function in Scheme:

(define (append lst1 lst2)
  (if (null? lst1)

Keybase proof

I hereby claim:

  • I am jwalsh on github.
  • I am jwalsh (https://keybase.io/jwalsh) on keybase.
  • I have a public key whose fingerprint is 9EC9 549C D2D6 487F 7D2B 41A8 D522 F8F0 E5EF 6663

To claim this, I am signing this object:

// Resolve a dependency graph to sequence
// https://web.stanford.edu/~jurafsky/slp3/15.pdf
const resolve = (sentence, deps) => {
let ops = [];
while (sentence.length > 0) {
let word = sentence.pop();
if (deps.hasOwnProperty(word)) {
console.log('Dependencies exist for', word);
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQENBF0198cBCADUXddFEe4jPV8r6NW/AWjMlLkkzIOUkAgoBpOosBWN3Q7vWJMl
rmkBV3rVy/qjZHXukf9TuZDeqkPQ9BumAuEDLX+KmlSvE1W+ar9gATPDofI0Cmok
FYhM8s+kM1M31I+wfWjvuMaGZJMOsxD7Bgr9JaXBM9yck2ZA6Gn3Am+M6UcDAh1j
ST6Y/ONZvjeUWVd/ysSjAcqAiL/FmCndDMq1+TaQzBp+viAPavN3hrx3w1VXR1HK
SnlcAzeWdlmLQBNlDAiNV0uJm1g6gKKfHb3zwetnswT52jlD7/atwoMHbPMpyKp1
p5MEG89XeYbo2UrubCU3iZBJa2VZe/6T9dxDABEBAAG0H0phc29uIFdhbHNoIDxq
d2Fsc2gxQGNoZXd5LmNvbT6JAU4EEwEIADgWIQTzbBmWV/ol8bo1TW+0lb/m/ZrG
CAUCXTX3xwIbAwULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAKCRC0lb/m/ZrGCLKv
HOST=example.com
npm install -g get-graphql-schema graphql-cli graphql-faker
mkdir graphql-faker-$HOST && cd graphql-faker-$HOST
graphql -p $HOST init
graphql -p $HOST get-schema
# The previous is the same as
# get-graphql-schema https://$HOST/graphql/ > schema.graphql
graphql-faker schema.graphql
export PATH="/usr/local/sbin:$PATH"
[[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"
alias emacs='/Applications/Emacs.app/Contents/MacOS/Emacs'
if [ -f "$(brew --prefix)/opt/bash-git-prompt/share/gitprompt.sh" ]; then
__GIT_PROMPT_DIR=$(brew --prefix)/opt/bash-git-prompt/share
GIT_PROMPT_ONLY_IN_REPO=1
source "$(brew --prefix)/opt/bash-git-prompt/share/gitprompt.sh"
// Procedure: Each connection should link lower to higher
let layout = [
[0, 1, 2],
[7, 8, 3],
[6, 5, 4],
];
// Encoding
let digits = [
"0107122334455667", // 0
import numpy as np
import cv2
import time
import datetime
# import the cascade for face detection
face_cascade = cv2.CascadeClassifier("cascades/haarcascade_frontalface_default.xml")
def TakeSnapshotAndSave():
# access the webcam (every webcam has a number, the default is 0)
@jwalsh
jwalsh / convolutional.py
Created February 12, 2019 16:49
Step 0, training batch accuracy 12 % Step 100, training batch accuracy 83 % Step 200, training batch accuracy 98 % Step 300, training batch accuracy 92 % Step 400, training batch accuracy 94 % Step 500, training batch accuracy 95 % Step 600, training batch accuracy 100 % Step 700, training batch accuracy 97 % Step 800, training batch accuracy 98…
import tensorflow as tf
image_size = 28
labels_size = 10
hidden_size = 1024
# Define placeholders
training_data = tf.placeholder(tf.float32, [None, image_size*image_size])
training_images = tf.reshape(training_data, [-1, image_size, image_size, 1])
import tensorflow as tf
tf.logging.set_verbosity(tf.logging.ERROR)
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
image_size = 28
labels_size = 10