Skip to content

Instantly share code, notes, and snippets.

@Pikaurd
Pikaurd / sqlite3_recover.c
Created June 12, 2020 08:38
sqlite3 fix by problem such as “disk image is malformed” and “database is locked”; fix logical from sqlite3.7.9 shell.c
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "sqlite3.h"
#include <ctype.h>
#include <stdarg.h>
#include <time.h>
#include "sqlite3_recover.h"
import UIKit
protocol StoredObject {
associatedtype Primitive
func toPrimitive() -> Primitive?
static func from(primitive: Primitive) -> Self?
}
protocol StoredAsSelf: StoredObject where Primitive == Self { }
@Pikaurd
Pikaurd / nv12.java
Last active July 4, 2018 09:57
Resize nv12 raw data
public static byte[] nv12ScaleDown(byte[] bytes, int width, int height) {
int newWidth = width >> 1;
int newHeight = height >> 1;
byte []result = new byte[bytes.length >> 2];
final int sourceOffset = width * height;
final int destOffset = newWidth * newHeight;
for (int h = 0; h < newHeight; h++) {
for (int w = 0; w < newWidth; w++) {
// manipulate y
#ifdef GL_ES
precision mediump float;
#endif
#define PI 3.1415927
#define PI2 2.0 * PI
#define FX_MIN_DURATION 0.1
#define FX_GAP 4.0
@Pikaurd
Pikaurd / RCTLocationObserver.m
Created December 20, 2015 10:14
Quick fix RCTLocationObserver of ReactNative v0.17.0
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import "RCTLocationObserver.h"