Skip to content

Instantly share code, notes, and snippets.

View oakes's full-sized avatar

Zach Oakes oakes

View GitHub Profile
@oakes
oakes / core.clj
Last active August 29, 2015 14:01
2D Physics
(def ^:const pixels-per-tile 32)
(defn create-ball-body!
[screen radius]
(let [body (add-body! screen (body-def :dynamic))]
(->> (circle-shape :set-radius radius)
(fixture-def :density 1 :friction 0 :restitution 1 :shape)
(body! body :create-fixture))
body))
@oakes
oakes / core.clj
Created May 27, 2014 19:03
3D Physics
(print "Click the screen to create a new block.")
(def ^:const mass 10)
(defn get-environment
[]
(let [attr-type (attribute-type :color :ambient-light)
attr (attribute :color attr-type 0.3 0.3 0.3 1)]
(environment :set attr)))
@oakes
oakes / core.clj
Last active May 28, 2016 08:16
Minimal 3D
(defscreen main-screen
:on-show
(fn [screen entities]
(update! screen
:renderer (model-batch)
:attributes (let [attr-type (attribute-type :color :ambient-light)
attr (attribute :color attr-type 0.8 0.8 0.8 1)]
(environment :set attr))
:camera (doto (perspective 75 (game :width) (game :height))
(position! 0 0 3)
@oakes
oakes / core.clj
Last active July 15, 2017 06:13
Standalone Nightmod Template
(ns my-game.core
(:require [clojure.edn :as edn]
[clojure.java.io :as io]
[play-clj.core :refer :all]
[play-clj.g2d :refer :all]
[play-clj.g3d :refer :all]
[play-clj.math :refer :all]
[play-clj.physics :refer :all]
[play-clj.ui :refer :all])
(:import [java.io StringWriter]))
guitar: o3 b8 > c8 d4 < b > c < a b g a %1
banjo: @1 o3 b8 > c8 d4 < b > c < a b g a %2
guitar: @2 o3 b8 > c8 d4 < b > c < a b g a %3
guitar: @3 d1 g4 g a b g b a1 %4
banjo: @4 g4 g a b g1 %5
@oakes
oakes / deps.edn
Last active February 12, 2021 14:30
{:deps {net.sekao/odoyle-rules {:mvn/version "RELEASE"}}}
@oakes
oakes / bug.nim
Last active February 20, 2021 10:17
# to build this with emscripten, you need emsdk on your PATH.
# first, clone https://github.com/emscripten-core/emsdk
# then in that repo run:
# ./emsdk install latest
# ./emsdk activate latest
# and then add the directories it prints out to your PATH
#
# then in this repo run:
# nim c -d:emscripten bug.nim
#
@oakes
oakes / bbs.ansiwave
Last active June 14, 2021 19:58
Ideas for a modern, decentralized BBS
██╗██████╗ ███████╗ █████╗ ███████╗ ███████╗ ██████╗ ██████╗ █████╗
██║██╔══██╗██╔════╝██╔══██╗██╔════╝ ██╔════╝██╔═══██╗██╔══██╗ ██╔══██╗
██║██║ ██║█████╗ ███████║███████╗ █████╗ ██║ ██║██████╔╝ ███████║
██║██║ ██║██╔══╝ ██╔══██║╚════██║ ██╔══╝ ██║ ██║██╔══██╗ ██╔══██║
██║██████╔╝███████╗██║ ██║███████║ ██║ ╚██████╔╝██║ ██║ ██║ ██║
╚═╝╚═════╝ ╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝
_______________________________________
|,---"-----------------------------"---,|
||___ ............................ ||
@oakes
oakes / project.clj
Last active October 17, 2021 22:57
Using Paravim with Leiningen
(defproject lein-paravim "0.1.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.10.1"]]
; since paravim is in the `:dev` profile,
; it will launch when you do `lein run`.
; if you don't want that behavior,
; just change `:dev` to something else.
; if you change it to `:paravim`, you can
; launch it by doing `lein with-profile paravim run`
:profiles {:dev {:dependencies [[paravim "RELEASE"]]
:main paravim.start
@oakes
oakes / digital_ocean.md
Last active September 28, 2022 21:46
Running a JAR on Digital Ocean
  • Create a Digital Ocean account
  • In the OS X terminal, run ssh-keygen, then hit enter until it is done
  • Create a droplet
    • Select Ubuntu 16.10 x64
    • In Finder, Go -> Go to Folder... then type ~/.ssh
    • Open id_rsa.pub with TextEdit
    • Copy the contents of the file and paste them in the "New SSH Key" text field
    • Click "Create"
  • In the Terminal app, run ssh root@YOUR_IP_ADDRESS
  • Run apt-get update