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
""" This simulates converting 24-bit RGB values to YUV, then back to 24-bit RGB. | |
Using BT.709 transfer functions: | |
https://en.wikipedia.org/wiki/Rec._709 | |
It demonstrates that converting to 30-bit YUV then back to 24-bit RGB is lossy. | |
Using 10 bits per YUV value appears to be lossless. | |
Converting RGB (24-bit) -> YUV (64-bit floats per channel, normalized [0-1]) -> RGB (24-bit) | |
Found 0 inaccurate conversions out of 16581375 RGB values |
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
#include <IOKit/IOKitLib.h> | |
#include <IOKit/hidsystem/IOHIDLib.h> | |
#include <IOKit/hidsystem/IOHIDParameter.h> | |
#include <CoreFoundation/CoreFoundation.h> | |
// Prints 0 if capslock is off. Prints 1 if capslock is on | |
// Modified from: https://discussions.apple.com/thread/7094207 | |
// Compile with: | |
// clang -framework IOKit -framework CoreFoundation -o capslock capslock.cpp |
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
require 'open3' | |
module Stockfish | |
class InvalidCommand < StandardError; end | |
class InvalidOption < StandardError; end | |
class Engine | |
attr_reader :stdin, :stdout, :stderr, :wait_threads, :version, :pid |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
body { | |
overflow: hidden; | |
font-family: Arial, sans-serif; | |
background: #222; | |
color: #eee; | |
margin: 0; |
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
#!/bin/bash | |
for i in {0..15}; do | |
row= | |
for j in {1..16}; do | |
color=$(( $i*16 + $j -1 )) | |
code="\033[00;38;5;${color}m${color}" | |
if [[ $row == "" ]]; then | |
row=$code | |
elif [[ $color -lt 11 ]]; then |
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
#!/bin/bash | |
curl -s "http://www.alexa.com/siteinfo/$1" | grep -Po "^([\d,]+)\s+" |