This file contains 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 bpy | |
import random | |
import math | |
import collections | |
import json | |
import queue | |
westernmost_longitude = -130 | |
def distance(a, b): |
This file contains 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
from PIL import Image | |
import random | |
import multiprocessing | |
background = Image.new('RGBA', (2048, 2048), (255, 255, 255, 255)) | |
image = Image.open(r"violin.jpg").convert('RGBA').load() | |
note = Image.open(r"note.png").convert('RGBA') | |
def gen_frame(frame): | |
for x in range(2048): |
This file contains 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 TypeFamilies #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
{-# LANGUAGE NoStarIsType #-} | |
{-# LANGUAGE DeriveGeneric #-} | |
module Cardinality where | |
import Data.Void |
This file contains 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 QuasiQuotes #-} | |
{-# LANGUAGE TemplateHaskellQuotes #-} | |
{-# LANGUAGE DeriveLift #-} | |
module Email where | |
import Language.Haskell.TH.Quote (QuasiQuoter(..)) | |
import Language.Haskell.TH.Syntax (Lift, lift, Q, Exp) | |
-- don't expose this constructor |
This file contains 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
# you will need a folder called `images` with pngs you want to add a border to, | |
# and a folder called `altered` where they'll be written to | |
from PIL import Image | |
import glob | |
WIDTH = 200 | |
HEIGHT = 500 | |
MARGIN = 10 | |
COLOR = (255, 255, 255, 255) # RGBA white |
This file contains 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 |
This file contains 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 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 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 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) |
NewerOlder