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
def render_single_kai_pixel(bands, hyperion_pixel): | |
weighted_R = [] | |
weighted_G = [] | |
weighted_B = [] | |
used_bands = [] | |
for band in bands: | |
if band >= 320 and band <= 1000: | |
used_bands.append(band) | |
weighted_R.append(hyperion_pixel(band) * KAI_R(band)) | |
weighted_G.append(hyperion_pixel(band) * KAI_G(band)) |
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 numpy | |
XYZ_to_sRGB_matrix = \ | |
numpy.array( | |
[[3.2404542, -1.5371385, -0.4985314], | |
[-0.9692660, 1.8760108, 0.0415560], | |
[0.0556434, -0.2040259, 1.0572252]]) | |
def apply_srgb_gamma(RGB): | |
non_linear = [] |
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 numpy | |
# R() is the reflectance of an object at a given band | |
# E() is the energy of the illuminant at a given band | |
# x_cmf() is the sensitivitiy of the X primary at a given band | |
# numpy.trapz(x_values, y_values) cacluated the area under a curve | |
X_curve = [] | |
Y_curve = [] | |
Z_curve = [] |
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
▶ TIMEOUT [expected OK] /websockets/Create-Secure-extensions-empty.htm | |
▶ Unexpected subtest result in /websockets/Create-Secure-extensions-empty.htm: | |
└ NOTRUN [expected PASS] W3C WebSocket API - Create Secure WebSocket - wsocket.extensions should be set to '' after connection is established - Connection should be closed | |
▶ Unexpected subtest result in /websockets/Create-Secure-extensions-empty.htm: | |
│ FAIL [expected PASS] W3C WebSocket API - Create Secure WebSocket - wsocket.extensions should be set to '' after connection is established - Connection should be opened | |
│ → assert_equals: extensions should be empty expected (string) "" but got (undefined) undefined | |
│ | |
│ @http://web-platform.test:8000/websockets/Create-Secure-extensions-empty.htm:9:13 |
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
print("UPDATE AUG 2023: this script is beyond old and broken") | |
print("You may find interesting and more up to date resources in the comments of the gist") | |
exit() | |
from slacker import Slacker | |
import json | |
import argparse | |
import os | |
# This script finds all channels, private channels and direct messages |
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 org.scalacheck.Gen | |
//Gen a long | |
val genLong = Gen.posNum[Long] | |
// Gen a string | |
val genString = Gen.alphaChar | |
//Gen random length list of longs | |
val genList = Gen.listOf(Gen.posNum[Long]) |
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
from bs4 import BeautifulSoup | |
# from terminal | |
# curl http://www.flowerexplosion.com/by-flower/roses.html?p=[1-11] > roses.html | |
# python scrape.py | |
filename = "roses.html" | |
with open (filename, "r") as infile: | |
html = BeautifulSoup(infile.read()) |
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
scala> def test(name: String = "joe"): Boolean = true | |
test: (name: String)Boolean | |
scala> val test: String => Boolean = { (name: String = "joe") => true } | |
<console>:1: error: ')' expected but '=' found. |
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
case class WriteEvent(name: String, records: List[Int]) | |
case class SingleRecord(name: String, value: Int) | |
val events = List( | |
WriteEvent("follow", List(1,2,3)), | |
WriteEvent("block", List(2,3,4)), | |
WriteEvent("follow", List(5,6,7)) | |
) |
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
def sideEffect() { | |
//increment hadoop counter | |
} | |
val list = List(Some("a"),Some("b"),None, Some("e"), None) | |
val filtered = list.flatMap { x => | |
if(x.isEmpty) sideEffect() | |
x | |
} |