Skip to content

Instantly share code, notes, and snippets.

View seanchen1991's full-sized avatar

Sean Chen seanchen1991

View GitHub Profile
@seanchen1991
seanchen1991 / .spacemacs
Last active January 10, 2022 15:51
Spacemacs dotfile
;; -*- mode: emacs-lisp; lexical-binding: t -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Layer configuration:
This function should only modify configuration layer settings."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
;; `+distribution'. For now available distributions are `spacemacs-base'

Keybase proof

I hereby claim:

  • I am seanchen1991 on github.
  • I am seanchen1991 (https://keybase.io/seanchen1991) on keybase.
  • I have a public key ASCc2bo7bnzbs-9ze9rmx2ADPJONPLwD673CmLnuNWticwo

To claim this, I am signing this object:

@seanchen1991
seanchen1991 / charter.md
Last active July 19, 2020 18:17 — forked from yaahc/charter.md
Error Handling Project Group Charter

Error Handling Project Group Charter

Motivation

The error handling project group aims to reduce confusion on how to structure error handling for users in the rust community. This will be accomplished by creating learning resources and pushing effort to upstream widely used crates into std. As a secondary goal this project group will also try to resolve some known issues with the Error trait and reporting errors in panics/termination.

Goals

Agree on and define common error handling terminology

@seanchen1991
seanchen1991 / shell.rs
Created January 13, 2020 20:03
Simple Rust Shell
use std::env;
use std::path::Path;
use std::io::prelude::*;
use std::io::{stdin, stdout, Write};
use std::process::{Command, Child, Stdio};
fn main() -> io::Result<()> {
loop {
print!("> ");
stdout.flush();
@seanchen1991
seanchen1991 / smallest_string.md
Created December 17, 2019 16:58
Smallest String Problem Statement

Smallest String

Write a function that takes two strings and returns the "smallest" string. If both strings are equal, you may return either string. Strings will only consist of lowercase letters and numbers: [a - z][0 - 9]. Letters earlier in the alphabet are considered smaller. Consecutive digits in the string should be considered a single number.

Examples:
@seanchen1991
seanchen1991 / sort_stack.md
Last active May 19, 2021 19:49
Problem description for the Sort Stack problem in JS

Sort Elements in a Stack

Given a Stack class like the following:

class Stack {
  constructor() {
    this.storage = [];
  }

 push(item) {
@seanchen1991
seanchen1991 / merge_sorted_lists.md
Last active April 23, 2020 20:42
Merge M Sorted Lists of Variable Length

Merge M Sorted Lists of Variable Length

Given M lists of variable length where every element in each list is sorted, print them out in sorted order efficiently.

Examples

Input: Four sorted lists of variable length

[32, 33],
[10, 20, 30, 40],
@seanchen1991
seanchen1991 / p1.md
Last active February 28, 2019 18:19
Smallest Missing Element from a Sorted Array

Find the Smallest Missing Element from a Sorted Array

Given a sorted array of distinct non-negative integers, find the smallest missing element in it.

Examples

Input: A = [0, 1, 2, 6, 9, 11, 15] Output: The smallest missing element is 3

Input: A = [1, 2, 3, 4, 6, 9, 11, 15]

@seanchen1991
seanchen1991 / truth_tables.md
Created February 19, 2019 16:50
Truth Tables Practice

Truth Table Practice

Fill out truth tables for the following expressions:

  1. (¬A v B) (alternate: (!A || B))
A     B     result
-------------------
0     0       ?
0     1       ?