Skip to content

Instantly share code, notes, and snippets.

View cindywu's full-sized avatar
🍍
i do not want to turn into dust, but into ashes instead

Cindy Wu cindywu

🍍
i do not want to turn into dust, but into ashes instead
View GitHub Profile

Keybase proof

I hereby claim:

  • I am cindywu on github.
  • I am cindywu (https://keybase.io/cindywu) on keybase.
  • I have a public key whose fingerprint is 7FF7 97E2 A860 CCC4 2611 7B7B FD36 D4EE 837A 9972

To claim this, I am signing this object:

@cindywu
cindywu / crackle-pop
Created April 26, 2020 05:26
crackle-pop
(define count 1)
(define (crackle-pop count n)
(cond ((and (= 0 (remainder count 3))(= 0 (remainder count 5))) (display "CracklePop\n"))
((= 0 (remainder count 3))(display "Crackle\n"))
((= 0 (remainder count 5))(display "Pop\n"))
(else (display count)(display "\n")))
(if (> n count) (crackle-pop (+ count 1) n)))
(crackle-pop count 100)
; this works!
; (crackle-pop 15) returns 1514131211109876543210
(define (crackle-pop n)
(display n)
(if (> n 0) (crackle-pop (- n 1))))
; show crackle if divisible by 3
; (crackle-pop 15) returns Crackle1413Crackle1110Crackle87Crackle54Crackle21Crackle
(define (crackle-pop n)
(if (= 0 (remainder n 3))
(define answers
'("It is certain."
"It is decidedly so."
"Without a doubt."
"Yes -- definitely."
"You may rely on it."
"As I see it, yes."
"Most likely."
"Outlook good."
"Yes."
(defun guess-my-number()
(ash (+ *small* *big*) -1))
(defun smaller ()
(setf *big* (1- (guess-my-number)))
(guess-my-number))
(defun bigger ()
(setf *small* (1+ (guess-my-number)))
(guess-my-number))
@cindywu
cindywu / talk
Last active May 3, 2020 04:50
talk
;server
(defparameter my-socket (socket-server 4321))
(defparameter my-stream (socket-accept my-socket))
;client
(defparamenter my-stream (socket-connect 4321 "127.0.0.1"))
(print "Yo Server!" my-stream)
;client recieves
(read my-stream)
@cindywu
cindywu / tic-tac-toe
Created May 4, 2020 08:49
tic-tac-toc
# new_game = TicTacToe.new
# new_game.play
class TicTacToe
def initialize(board = nil)
@board = ["1", "2", "3", "4", "5", "6", "7", "8", "9"]
end
def display_board(board)
puts "|#{board[0]}|#{board[1]}|#{board[2]}|"
puts "|#{board[3]}|#{board[4]}|#{board[5]}|"
@cindywu
cindywu / tictactoe.scm
Last active May 5, 2020 03:18
it barely works
(define board '(1 2 3 4 5 6 7 8 9))
(define win-combos '((1 2 3) (4 5 6) (7 8 9) (1 4 7) (2 5 8) (3 6 9) (1 5 9) (3 5 7)))
(define (won win-combos board)
(cond
((null? win-combos)#f)
((equal? '(x x x) (returncombostate (car win-combos) board)) #t)
((equal? '(o o o) (returncombostate (car win-combos) board)) #t)
(else
@cindywu
cindywu / ttt-computerplayer.scm
Created May 8, 2020 12:34
computer player 'o picks 2
(define board '(1 2 3 4 5 6 7 8 9))
(define win-combos '((1 2 3) (4 5 6) (7 8 9) (1 4 7) (2 5 8) (3 6 9) (1 5 9) (3 5 7)))
(define (won win-combos board)
(cond
((null? win-combos)#f)
((equal? '(x x x) (returncombostate (car win-combos) board)) #t)
((equal? '(o o o) (returncombostate (car win-combos) board)) #t)
(else
@cindywu
cindywu / mls-ch-4.scala
Created May 25, 2020 06:38
machine learning systems chapter 4
// import Tokenizer and HasingTF... you might need IDF later?
import org.apache.spark.ml.feature.{HashingTF, IDF, Tokenizer}
// import Pipeline
import org.apache.spark.ml.Pipeline
// 4.1 extracting features
def extract(rawData: RawData): Feature = ???
// 4.2 extracting word features from squawks