Y = a * R + b * G + c * B
Cb = (B - Y) / d
Cr = (R - Y) / e
BT.601 | BT.709 | BT.2020 | |
---|---|---|---|
a | 0.299 | 0.2126 | 0.2627 |
b | 0.587 | 0.7152 | 0.6780 |
package com.example.glcube; | |
import java.nio.ByteBuffer; | |
import java.nio.ByteOrder; | |
import java.nio.FloatBuffer; | |
import java.nio.ShortBuffer; | |
import javax.microedition.khronos.egl.EGLConfig; | |
import javax.microedition.khronos.opengles.GL10; |
Y = a * R + b * G + c * B
Cb = (B - Y) / d
Cr = (R - Y) / e
BT.601 | BT.709 | BT.2020 | |
---|---|---|---|
a | 0.299 | 0.2126 | 0.2627 |
b | 0.587 | 0.7152 | 0.6780 |
# One liner | |
wget --recursive --page-requisites --adjust-extension --span-hosts --convert-links --restrict-file-names=windows --domains yoursite.com --no-parent yoursite.com | |
# Explained | |
wget \ | |
--recursive \ # Download the whole site. | |
--page-requisites \ # Get all assets/elements (CSS/JS/images). | |
--adjust-extension \ # Save files with .html on the end. | |
--span-hosts \ # Include necessary assets from offsite as well. | |
--convert-links \ # Update links to still work in the static version. |
import android.content.ComponentName; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.content.ServiceConnection; | |
import android.os.IBinder; | |
import android.support.annotation.Nullable; | |
/** | |
* This class based on official | |
* <a href="http://developer.android.com/guide/components/bound-services.html">documentation</a> |
#!/bin/bash | |
sudo add-apt-repository -y ppa:git-core/ppa | |
sudo apt-get update | |
sudo apt-get install git -y |
# http://stackoverflow.com/questions/1855095/how-to-create-a-zip-archive-of-a-directory | |
import os | |
import zipfile | |
import hashlib | |
import time | |
def zipdir(path, ziph): | |
for root, dirs, files in os.walk(path): | |
if '.git' not in root: | |
for file in files: |
// Really awesome code taken from: http://apangborn.com/2011/05/pixel-processing-using-arm-assembly/ | |
inline static void neon_rgba_to_bgra(unsigned char *src, unsigned char *dst, int numPixels) | |
{ | |
#ifdef __ARM_NEON__ | |
int simd_pixels = numPixels & ~7; // round down to nearest 8 | |
int simd_iterations = simd_pixels >> 3; | |
int col; | |
if(simd_iterations) { // make sure at least 1 iteration | |
__asm__ __volatile__ ("1: \n\t" | |
// structured load of 8 pixels into d0-d3 (64-bit) NEON registers |
Run the following in the terminal:
Install the gcc-7 packages:
sudo apt-get install -y software-properties-common
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install g++-7 -y
Set it up so the symbolic links gcc
, g++
point to the newer version:
// NOTE: only escapes a " if it's not already escaped | |
function escapeDoubleQuotes(str) { | |
return str.replace(/\\([\s\S])|(")/g,"\\$1$2"); // thanks @slevithan! | |
} | |
escapeDoubleQuotes(`ab`); // ab => ab (nothing escaped) | |
escapeDoubleQuotes(`a"b`); // a"b => a\"b | |
escapeDoubleQuotes(`a\\"b`); // a\"b => a\"b (nothing escaped) | |
escapeDoubleQuotes(`a\\\\"b`); // a\\"b => a\\\"b | |
escapeDoubleQuotes(`a\\\\\\"b`); // a\\\"b => a\\\"b (nothing escaped) |
import io | |
import selectors | |
import subprocess | |
import sys | |
def capture_subprocess_output(subprocess_args): | |
# Start subprocess | |
# bufsize = 1 means output is line buffered | |
# universal_newlines = True is required for line buffering | |
process = subprocess.Popen(subprocess_args, |