This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Tree drawings | |
-- Left click and drag to pan the drawing | |
-- Right click and drag to zoom | |
-- install this by running `cabal install gloss` | |
-- You may need to install/update opengl | |
import Graphics.Gloss | |
-- Config variables for n-ary tree with k levels of depth |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Relativity exposing (main) | |
import Html exposing (..) | |
import Html.Attributes exposing (style, src, min, max, type_, value) | |
import Html.Events exposing (onClick, onInput, onMouseEnter, onMouseDown, onMouseUp) | |
type Msg | |
= SetMacro String | |
| SetMedium String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
def soupify(url): | |
page = requests.get(url) | |
return BeautifulSoup(page.text, 'html.parser') | |
parks = soupify('https://www.nps.gov/planyourvisit/fee-free-parks-state.htm').find_all('a') | |
for park in parks: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
import Control.Monad.IO.Class | |
import Control.Monad.Trans.State | |
import Data.Word | |
import Foreign.C.Types | |
import Graphics.UI.GLUT as GL hiding (Window, createWindow, bitmap, get, renderer) | |
import SDL hiding (get) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE DeriveGeneric #-} | |
module Main where | |
import Control.Applicative | |
import Data.Aeson | |
import Data.Char | |
import GHC.Generics | |
import Numeric |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE TypeFamilyDependencies #-} | |
module Nat where | |
-- Our own little prelude with just Bool and not | |
import Prelude((++), Show(..), error) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
POPULATION_SIZE = 1000 | |
HEIGHT = 5 | |
WIDTH = 20 | |
MUTATION_CHANCE = 1 / (WIDTH * HEIGHT) | |
def randChar(): | |
"""Get a random gene. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const SIZE: usize = 3; | |
const SUM: u32 = magic_constant(SIZE as u32); | |
const fn magic_constant(n: u32) -> u32 { | |
return n * (n * n + 1) / 2; | |
} | |
const fn initial() -> [[u32; SIZE]; SIZE] { | |
return [[0; SIZE]; SIZE]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://www.realtimerendering.com/raytracing/Ray%20Tracing%20in%20a%20Weekend.pdf | |
use cgmath::Vector3; | |
use rand::prelude::*; | |
type Point = Vector3<f64>; | |
fn point(x: f64, y: f64, z: f64) -> Point { | |
return Vector3::new(x, y, z); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bs4 | |
import httplib2 | |
import spotipy | |
import sys | |
import time | |
url = 'http://example.com/music' # full url of a site with spotify links on it | |
username = 'username' # your spotify username | |
playlist_id = 'abcdef1234567890' # id of the playlist you want tracks to fill |
OlderNewer