Skip to content

Instantly share code, notes, and snippets.

@commshare
commshare / android_ares_config.patch
Created July 9, 2019 08:36
Build gRPC for Android
46c46
< #define GETSERVBYPORT_R_ARGS 6
---
> #define GETSERVBYPORT_R_ARGS
131c131
< #define HAVE_GETSERVBYPORT_R
---
> /* #undef HAVE_GETSERVBYPORT_R */
46c46
< #define GETSERVBYPORT_R_ARGS 6
@commshare
commshare / ..build-protobuf-3.0.0.md
Created March 16, 2019 08:51 — forked from petewarden/..build-protobuf-3.0.0.md
Script used to build Google Protobuf 3.0.0 for use with Xcode 7 / iOS 9. Builds all supported architectures and produces a universal binary static library.

Google Protobuf 3.0.1 - Mac OS X and iOS Support

The script in this gist will help you buid the Google Protobuf library for use with Mac OS X and iOS. Other methods (such as homebrew or direct compilation) have issues that prevent their use. The libraries built by this script are universal and support all iOS device architectures including the simulator.

This gist was adapted from the original at https://gist.github.com/BennettSmith/7150245, and updated to deal with Xcode 7 and iOS 9, and download protobuf version 3.0.0.

@commshare
commshare / wifi_rebooter.md
Last active May 1, 2019 20:22
Automatically Reconnecting WiFi on a RaspberryPi

Automatically Reconnecting WiFi on a RaspberryPi (alexba.in/blog/2015/01/14/automatically-reconnecting-wifi-on-a-raspberrypi/) JAN 14TH, 2015 | COMMENTS In this post, I’m going to cover writing a short script that automatically reconnects a RaspberryPi to a WiFi network. The script will check to see if the Pi has network connectivity and, if it’s offline, will restart the wireless interface to bring it back online. We’ll use cron to schedule the execution of this script at a regular interval.

There are a few ways to determine if the RaspberryPi has network connectivity. For this script, we’ll be using ping.

Writing the script To get started, we’ll need to determine if the RaspberryPi is connected to the network. To do this, we’ll attempt to ping a server and see if we get a response. If the command succeeds (RaspberryPi receives a response from the server), we have network connectivity. If the command fails, we’ll turn wlan0 off and back on.

#!/bin/bash
@commshare
commshare / enable_wlan0.md
Last active April 10, 2018 16:08
enable_wlan0

生成一个密码

root@orangepiplus:~# wpa_passphrase TPLINK-2018 
# reading passphrase from stdin
mypasswd
network={
        ssid="TPLINK-2018"
        #psk="mypasswd"
        psk=8a278324210558dad1a1bb182113f0df8fcee75946d31b25c7b839d98bbd49f7
}
@commshare
commshare / homebrew-libsoil.txt
Created October 4, 2017 02:23
brew install libsoil
https://github.com/zmarcantel/homebrew-libsoil
zhangbindeMacBook-Pro:~ zhangbin$ brew tap zmarcantel/libsoil
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
binaryen firebase-cli grpc planck
dnsviz fonttools paket pyenv
ejabberd git-lfs pilosa
@commshare
commshare / YUV422SP转YUV422P.c
Created October 29, 2015 09:59
YUV422SP转YUV422P
YUV422SP转YUV422P from git@github.com:commshare/YUVPlayer.git
作者:李迟 发布:2014-09-08 11:22 分类:我的程序代码 标签:代码积累, 工程库代码, 编程 阅读:1,892 次 无评论
最近为了测试采集的YUV视频是否正确,不过用YUV播放器看不了YUV422SP的文件。为了让其正确播放,写了个转换函数,当然,没经什么优化。但作为测试手段,已经足够了。
下面给出YUV422SP转YUV422P格式的转换函数,当然,也包括了YUV420SP转YUV420P。代码没什么技术含量,不多说。
/**
yyyy yyyy
uv uv
->
yyyy yyyy
uu
@commshare
commshare / yuv2nv12.c
Created October 22, 2015 15:54
yuv2nv12
//https://github.com/shenxingdeliulu/webcam/blob/master/capture.c
#include "capture.h"
#define CLEAR(x) memset (&(x), 0, sizeof (x))
static char * dev_name = "/dev/video0";//摄像头设备名
struct buffer * buffers = NULL;
static unsigned int n_buffers = 0;
unsigned char *yuyv;
const int yuyv_frm_sz=w*h*2;
@commshare
commshare / OpenMAX_Event.c
Last active October 21, 2015 08:04
jan老师的OpenMAX state示例2:monitor events
/*
https://jan.newmarch.name/RPi/OpenMAX/State/event.c
The program event.c monitors events. When run on the OMX.broadcom.clock component,
it reports disabling all five ports, transitioning to Idle and then Executing
*/
#include <stdio.h>
#include <stdlib.h>
#include <OMX_Core.h>
#include <OMX_Component.h>
@commshare
commshare / jan_OpenMAX_state_switch.c
Last active October 21, 2015 06:32
jan老师的OpenMAX state切换示范程序
/*
https://jan.newmarch.name/RPi/OpenMAX/State/wontwork.c
*/
/*
* WARNING: THIS PROGRAM DOESN'T WORK 这个程序不可以直接运行
*/
#include <stdio.h>
#include <stdlib.h>
@commshare
commshare / OMXEncTest_print_usage.c
Last active October 21, 2015 02:53
omxenctest usage print
/*
print_usage
*/
void print_usage(OMX_STRING swname)
{
printf("usage: %s [options]\n"
"\n"
" Available options:\n"
#if !defined (ENC8290) && !defined (ENCH1) 可以编码为avc 或者jpeg
" -O, --outputFormat Compression format; 'avc', 'mpeg4', 'h263' or 'jpeg'\n"