Skip to content

Instantly share code, notes, and snippets.

@jwalsh
jwalsh / titanic.csv
Last active September 20, 2024 07:30
PassengerId Survived Pclass Lname Name Sex Age SibSp Parch Ticket Fare Cabin Embarked
1 0 3 Braund Mr. Owen Harris male 22 1 0 A/5 21171 7.25 S
2 1 1 Cumings Mrs. John Bradley (Florence Briggs Thayer) female 38 1 0 PC 17599 71.2833 C85 C
3 1 3 Heikkinen Miss. Laina female 26 0 0 STON/O2. 3101282 7.925 S
4 1 1 Futrelle Mrs. Jacques Heath (Lily May Peel) female 35 1 0 113803 53.1 C123 S
5 0 3 Allen Mr. William Henry male 35 0 0 373450 8.05 S
6 0 3 Moran Mr. James male 0 0 330877 8.4583 Q
7 0 1 McCarthy Mr. Timothy J male 54 0 0 17463 51.8625 E46 S
8 0 3 Palsson Master. Gosta Leonard male 2 3 1 349909 21.075 S
9 1 3 Johnson Mrs. Oscar W (Elisabeth Vilhelmina Berg) female 27 0 2 347742 11.1333 S

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)
#!/bin/sh
# 1. Define a base set of credentials with APPID and APPSECRET
. ~/.facebookrc
# APPID=
# APPSECRET=
function init {
echo
echo
// 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);

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:

/**
* allCookies.setItem(sKey, sValue, vEnd, sPath, sDomain, bSecure)
*
* @argument sKey (String): the name of the cookie;
* @argument sValue (String): the value of the cookie;
* @optional argument vEnd (Number - finite or Infinity, String, Date object or null): the max-age in seconds (e.g.
* 31536e3 for a year) or the expires date in GMTString format or in Date Object format; if not specified it will
* expire at the end of session;
* @optional argument sPath (String or null): e.g., "/", "/mydir"; if not specified, defaults to the current path
* of the current document location;
-----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