Skip to content

Instantly share code, notes, and snippets.

/**
Utility method to build a Boolean decision tree in the form of a compound
NSPredicate which can be used to perform a full-text search on a collection.
The resulting predicate will match only those objects which, for each search
term, have at least one keypath in the set of provided keypaths for which the
corresponding value matches the search term. The type of operator to perform
(prefix, contains, exact match) can be configured, as can diacritic-sensitivity
and case-sensitivity options.
@param searchString A space-delimited list of search terms
#!/bin/bash
# Disallow undefined variables
set -u
default_gcc_version=4.2
default_iphoneos_version=6.1
default_macos_version=10.8.4
GCC_VERSION="${GCC_VERSION:-$default_gcc_version}"
@pcannon67
pcannon67 / AccessDump.py
Created October 2, 2015 15:33 — forked from mywarr/AccessDump.py
use mdbtools to convert .mdb to .sqlite and .csv
#!/usr/bin/env python
#
# AccessDump.py
# A simple script to dump the contents of a Microsoft Access Database.
# It depends upon the mdbtools suite:
# http://sourceforge.net/projects/mdbtools/
import sys, subprocess, os
DATABASE = sys.argv[1]
@pcannon67
pcannon67 / orbslam2_ubuntu_mate.md
Created July 19, 2018 20:49 — forked from nickoala/orbslam2_ubuntu_mate.md
Build ORB-SLAM2 on Raspberry Pi 3

Build ORB-SLAM2 on Raspberry Pi 3

Operating system: Ubuntu Mate 16.04

I use Ubuntu Mate instead of the usual Raspbian Jessie mainly because of the gcc version. ORB-SLAM2 requires C++11 support. Raspbian comes with gcc 4.9, which does not handle C++11 by default. That means you have to play around with some compiler flags in ORB-SLAM2's CMakeLists.txt to make it work. In contrast, Ubuntu Mate's gcc 5.4 handles C++11 naturally.

@pcannon67
pcannon67 / zram.sh
Created July 20, 2018 13:41 — forked from sultanqasim/zram.sh
ZRAM config for Raspberry Pi 3
#!/bin/bash
# Raspberry Pi ZRAM script
# Tuned for quad core, 1 GB RAM models
# put me in /etc/init.d/zram.sh and make me executable
# then run "sudo update-rc.d zram.sh defaults"
modprobe zram
echo 3 >/sys/devices/virtual/block/zram0/max_comp_streams
echo lz4 >/sys/devices/virtual/block/zram0/comp_algorithm

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.

@pcannon67
pcannon67 / mdb2sqlite.sh
Last active July 24, 2019 21:37 — forked from umrysh/mdb2sqlite.sh
A modified version of the "Converting MS Access mdb files to sqlite" script posted at: http://pnenp.wordpress.com/2011/02/10/converting-ms-access-mdb-files-to-sqlite-mdb2sqlite/
#!/bin/bash
# Inspired by:
# http://nialldonegan.me/2007/03/10/converting-microsoft-access-mdb-into-csv-or-mysql-in-linux/
# http://cltb.ojuba.org/en/articles/mdb2sqlite.html
# Dave's Modifications:
# Line 25: Added code to remove COMMENT and SET statements.
# Lines 28 to 37: Added code to handle primary keys.
# Line 51: Added "postgres" to mdb-export command.
@pcannon67
pcannon67 / curl_example.cpp
Created July 27, 2019 19:56 — forked from alghanmi/curl_example.cpp
cURL C++ Example
#include <iostream>
#include <string>
#include <curl/curl.h>
static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp)
{
((std::string*)userp)->append((char*)contents, size * nmemb);
return size * nmemb;
}
@pcannon67
pcannon67 / test.cpp
Created July 27, 2019 20:07 — forked from FatalCatharsis/test.cpp
A poco http example
Poco::JSON::Object obj;
obj.set("name", "blah");
obj.set("language", "english");
Poco::URI uri("http://the-uri-you-want-to-request-from");
std::string path(uri.getPathAndQuery());
if (path.empty()) path = "/";
HTTPClientSession session(uri.getHost(), uri.getPort());
HTTPRequest request(HTTPRequest::HTTP_POST, path, HTTPMessage::HTTP_1_1);