Skip to content

Instantly share code, notes, and snippets.

@ruisebastiao
ruisebastiao / README.md
Created January 16, 2021 21:20 — forked from taxilian/README.md
Mongodb scripts for incremental backup

Introduction

I can't take credit for much of the work here -- I adapted it from this blog post: https://tech.willhaben.at/mongodb-incremental-backups-dff4c8f54d58

My main contribution was to make it a little easier to use with docker as well as numerous little cleanup tasks. I also made it gzip the oplog backups and added support for SSL connections

Note that I havne't yet tested the point in time restore script; it likely needs work, particularly to make things work with the gzipped oplog files

#!/bin/bash
function initStaticParams
{
MONGODB_SERVER=127.0.0.1
MONOGDB_PORT=27017
MONGODB_USER=
MONGODB_PWD=
OUTPUT_DIRECTORY=/mnt/backups/oplogs
LOG_FILE="/appl/mongo-backup/logs/backup.log"
@ruisebastiao
ruisebastiao / docker-compose.yml
Created October 2, 2020 22:43 — forked from aeimer/docker-compose.yml
Setup OpenVPN with OpenVPN-Monitor and docker-compose
version: "2"
services:
openvpn:
image: kylemanna/openvpn
volumes:
- "./data:/etc/openvpn"
- "/etc/localtime:/etc/localtime:ro"
ports:
- "1194:1194/udp"
expose:
@ruisebastiao
ruisebastiao / 01-README.md
Created June 28, 2020 13:17 — forked from TheJLifeX/00-hand-gesture-recognition.gif
Simple Hand Gesture Recognition Code - Hand tracking - Mediapipe

Simple Hand Gesture Recognition Code - Hand tracking - Mediapipe

Goal of this gist is to recognize ONE, TWO, TREE, FOUR, FIVE, SIX, YEAH, ROCK, SPIDERMAN and OK. We use the LANDMARKS output of the LandmarkLetterboxRemovalCalculator. This output is a landmark list that contains 21 landmark. In the 02-landmarks.jpg picture below you can see the index of each landmark. Each landmark have x, y and z values. But only x, y values are sufficient for our Goal. If you dont want to copy/paste each the code on this gist, you can clone my forked version of mediapipe here: https://github.com/TheJLifeX/mediapipe. I have already commited all code in that repository.

We have five finger states.

  1. thumbIsOpen
@ruisebastiao
ruisebastiao / tf-rasp.md
Created June 26, 2020 19:50 — forked from EKami/tf-rasp.md
Building TensorFlow for Raspberry Pi: a Step-By-Step Guide

Building TensorFlow 1.3.0-rc1 for Raspberry Pi/Ubuntu 16.04: a Step-By-Step Guide

Here you'll learn how to build Tensorflow for the raspberry pi 3 with either the Python API or as a standalone shared library which can be interfaced from the C++ API and eventually as a library which can be used in other languages.

For the C++ library this tutorial will show you how extract tensorflow library and headers to use in any environment you want.

(This tutorial couldn't be possible without the help of the people from the References section)

What You Need

Set or Get Property from Camera using OpenCV

欲想對視訊操作解析度、白平衡、FPS等可透過VideoCapture.set()實現。

參數

  • CV_CAP_PROP_POS_MSEC 影片播放毫秒
  • CV_CAP_PROP_POS_FRAMES 影片播放幀數
  • CV_CAP_PROP_POS_AVI_RATIO 影片播放百分比
  • CV_CAP_PROP_FRAME_WIDTH 影像解析度(寬)
  • CV_CAP_PROP_FRAME_HEIGHT 影像解析度(高)
@ruisebastiao
ruisebastiao / Readme.md
Created December 30, 2018 10:38 — forked from brgaulin/Readme.md
ng2-smart-table datepicker

Install

npm install --save ng-pick-datetime

Setup

Add the component in this gist to your project Add to your smart table settings:

@ruisebastiao
ruisebastiao / nginx.conf
Created May 28, 2018 23:38 — forked from nrollr/nginx.conf
NGINX config for SSL with Let's Encrypt certs
# Advanced config for NGINX
server_tokens off;
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options nosniff;
# Redirect all HTTP traffic to HTTPS
server {
listen 80;
server_name www.domain.com domain.com;
return 301 https://$host$request_uri;
import {Injectable, provide} from 'angular2/core';
import {Observable} from 'rxjs';
const GEOLOCATION_ERRORS = {
'errors.location.unsupportedBrowser': 'Browser does not support location services',
'errors.location.permissionDenied': 'You have rejected access to your location',
'errors.location.positionUnavailable': 'Unable to determine your location',
'errors.location.timeout': 'Service timeout has been reached'
};
@ruisebastiao
ruisebastiao / MongoDB update all matching.js
Created March 27, 2018 14:32 — forked from sym3tri/MongoDB update all matching.js
How to update a single field in a MongoDB collection for all documents matching a specific criteria
// FROM: http://www.mongodb.org/display/DOCS/Updating#Updating-update%28%29
//
// db.collection.update( criteria, objNew, upsert, multi )
// criteria - query which selects the record to update;
// objNew - updated object or $ operators (e.g., $inc) which manipulate the object
// upsert - if this should be an "upsert"; that is, if the record does not exist, insert it
// multi - if all documents matching criteria should be updated
//
// SQL VERSION:
// UPDATE myTable SET dateField = '2011-01-01' WHERE condField = 'condValue'