Skip to content

Instantly share code, notes, and snippets.

fun <I> ActivityResultCaller.registerForActivityResult(
onCreateIntent: Context.(input: I) -> Intent,
callback: ActivityResultCallback<Pair<Int, Intent?>>,
) = registerForActivityResult(
activityResultContract(onCreateIntent),
callback,
)
/**
* ```

Install dlib and face_recognition on a Raspberry Pi

Instructions tested with a Raspberry Pi 2 with an 8GB memory card. Probably also works fine on a Raspberry Pi 3.

Steps

Download the latest Raspbian Jessie Light image. Earlier versions of Raspbian won't work.

Write it to a memory card using Etcher, put the memory card in the RPi and boot it up.

@crearo
crearo / gstreamer-recording-dynamic.c
Last active January 17, 2024 18:26
Example of dynamic pipeline in Gstreamer (recording + display). Stop recording at will by hitting ctrl+c.
#include <string.h>
#include <gst/gst.h>
#include <signal.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
// v4l2src ! tee name=t t. ! x264enc ! mp4mux ! filesink location=/home/rish/Desktop/okay.264 t. ! videoconvert ! autovideosink
static GMainLoop *loop;
@crearo
crearo / gstreamer-tee-recording-and-display.c
Created March 20, 2017 11:47
Example of tee in gstreamer. recording + display.
#include <string.h>
#include <gst/gst.h>
#include <signal.h>
#include <unistd.h>
#include <stdlib.h>
// v4l2src ! tee name=t t. ! x264enc ! mp4mux ! filesink location=/home/rish/Desktop/okay.264 t. ! videoconvert ! autovideosink
static GMainLoop *loop;
static GstElement *pipeline, *src, *tee, *encoder, *muxer, *filesink, *videoconvert, *videosink, *queue_record, *queue_display;
@crearo
crearo / gstreamer-recording.c
Created March 20, 2017 09:45
A Gstreamer example using GstElements to record a v4l2src stream.
#include <string.h>
#include <gst/gst.h>
#include <signal.h>
#include <unistd.h>
#include <stdlib.h>
// gst-launch-1.0 v4l2src ! x264enc ! mp4mux ! filesink location=/home/rish/Desktop/okay.264 -e
static GMainLoop *loop;
static GstElement *pipeline, *src, *encoder, *muxer, *sink;
static GstBus *bus;
@ted-piotrowski
ted-piotrowski / visualstudiocode.sh
Last active August 31, 2022 14:27
Visual Studio Code on ARM Debian Linux
# building Visual Studio Code Debian package on ARM
# get source code
git clone git@github.com:Microsoft/vscode.git
cd vscode
# build debian package
./scripts/npm.sh install --arch=armhf
./node_modules/.bin/gulp vscode-linux-arm-build-deb
@wotupset
wotupset / 160830.poi
Last active April 23, 2024 09:16
komica大爆射的gif貼圖跟顏文字
++
(´◓Д◔`) 哇幹!!
( っค้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้c )
++
(´◓Д◔`) 哇幹!!
( っค้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้้c )
++
@yongjhih
yongjhih / AsyncAwait.dart
Last active August 29, 2015 14:17
RxAsyncAwait.java
// ref. http://news.dartlang.org/2015/03/dart-19-release-youve-been-await-ing-for.html?m=1
Future<int> getCount(bool showCustomers) async {
try {
var database = await connectDb();
var count = await database.queryEmployees().length;
if (showCustomers) {
count += await database.queryCustomers().length;
}
return count;
} on DbError catch (error, stack) {
@jetsonhacks
jetsonhacks / gEncodeH264WithPreviews.sh
Last active September 8, 2019 17:30
Using Gstreamer, take a h264 stream from a Logitech c920, preview it on the display and save it to a file along with the webcam audio.
#!/bin/sh
# Preview and save webcam video on NVIDIA Jetson TK1
# Grab audio and video (in h264 format) from Logitech c920 @ 1920x1080
# Preview @ 1280x720 on screen
# Store video to file named gEncode1080p.mp4
# Logitech c920 is video1 on this machine
VELEM="v4l2src device=/dev/video1 do-timestamp=true"
# Video capability from the camera - get h264 1920x1080
VCAPS="video/x-h264, width=1920, height=1080, framerate=30/1"
package com.story.util;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
//import android.database.sqlite.SQLiteQueryBuilder;
/**
* The selection and selectionArgs helper, SQLiteQueryBuilder.appendWhere(where) whereClause alternative.