Skip to content

Instantly share code, notes, and snippets.

View jusonqiu's full-sized avatar
😄
I may be slow to respond.

jusonqiu

😄
I may be slow to respond.
  • Tencent
  • ShenZhen
View GitHub Profile
@jusonqiu
jusonqiu / ios.toolchain.cmake
Created March 2, 2021 03:05
ios toolchain cmake
# Fix for PThread library not in path
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(CMAKE_USE_WIN32_THREADS_INIT 0)
set(CMAKE_USE_PTHREADS_INIT 1)
# Cache what generator is used
set(USED_CMAKE_GENERATOR "${CMAKE_GENERATOR}" CACHE STRING "Expose CMAKE_GENERATOR" FORCE)
@jusonqiu
jusonqiu / iOS.m
Last active March 30, 2020 09:15
iOS.m
//ios label
lineBreakMode:设置标签文字过长时的显示方式。
label.lineBreakMode = NSLineBreakByCharWrapping; //以字符为显示单位显示,后面部分省略不显示。
label.lineBreakMode = NSLineBreakByClipping; //剪切与文本宽度相同的内容长度,后半部分被删除。
label.lineBreakMode = NSLineBreakByTruncatingHead; //前面部分文字以……方式省略,显示尾部文字内容。
label.lineBreakMode = NSLineBreakByTruncatingMiddle; //中间的内容以……方式省略,显示头尾的文字内容。
label.lineBreakMode = NSLineBreakByTruncatingTail; //结尾部分的内容以……方式省略,显示头的文字内容。
label.lineBreakMode = NSLineBreakByWordWrapping;
@jusonqiu
jusonqiu / For Mac 4.2.6 unlimited trial.md
Created November 12, 2019 01:58 — forked from rise-worlds/For Mac 4.2.6 unlimited trial.md
Beyond Compare 4 license for Windows, Mac, Linux

for 4.2.4 or higher,4.2.5,4.2.6 ,it's works , this is the way which makes Always in evaluation mode 。

  1. go to the dir : /Applications/Beyond Compare.app/Contents/MacOS
  2. change the name BCompare to BCompare.bak
  3. touch a file name BCompare , and chmod a+u BCompare
  4. insert BCompare the content :
#!/bin/bash
rm "/Users/$(whoami)/Library/Application Support/Beyond Compare/registry.dat"
"`dirname "$0"`"/BCompare.bak $@
@jusonqiu
jusonqiu / android-status-bar.kt
Created June 5, 2019 09:24
设置android status bar 沉浸式
private fun setTranslucentStatus() {
// 5.0以上系统状态栏透明
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
//设置沉浸状态
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
//设置UI渗入,StatusBar ICON 颜色
var options = SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or SYSTEM_UI_FLAG_LAYOUT_STABLE
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){
options = options or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR //dark icon
#include <stdio.h>
#define KNRM "\x1B[0m"
#define KRED "\x1B[31m"
#define KGRN "\x1B[32m"
#define KYEL "\x1B[33m"
#define KBLU "\x1B[34m"
#define KMAG "\x1B[35m"
#define KCYN "\x1B[36m"
#define KWHT "\x1B[37m"
@jusonqiu
jusonqiu / yuv2rgb.c
Last active December 5, 2023 06:38
Convert YUV to RGB
/* convert a YUV set to a rgb set - thanks to MartinS and
http://www.efg2.com/lab/Graphics/Colors/YUV.htm */
static void yuvtorgb(int Y, int U, int V, u8 *rgb)
{
int r, g, b;
static short L1[256], L2[256], L3[256], L4[256], L5[256];
static int initialised;
if (!initialised) {
int i;
#include <stdio.h>
#include <openssl/rsa.h>
#include <openssl/pem.h>
#include <openssl/err.h>
#include <string.h>
#define KEY_LENGTH 2048
#define PUB_EXP 3
#define PRINT_KEYS
#define WRITE_TO_FILE
cat $1 | hexdump -v -e '7/1 "0x%02X, " 1/1 " 0x%02X,\n"'
@jusonqiu
jusonqiu / makewave.c
Last active March 30, 2020 09:18
Create 44Byte Header Wave File
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
/* M_PI is declared in math.h */
#define PI M_PI
typedef unsigned int UI;
@jusonqiu
jusonqiu / simplest_ffmpeg_streamer.c
Created October 9, 2015 03:42
* This example stream local media files to streaming media ,server (Use RTMP as example),It's the simplest FFmpeg streamer. source from [雷霄骅](http://blog.csdn.net/leixiaohua1020)
#include <stdio.h>
#include <libavformat/avformat.h>
#include <libavutil/mathematics.h>
#include <libavutil/time.h>
int main(int argc, char* argv[])
{
AVOutputFormat *ofmt = NULL;
//输入对应一个AVFormatContext,输出对应一个AVFormatContext
//(Input AVFormatContext and Output AVFormatContext)