Skip to content

Instantly share code, notes, and snippets.

View AhiyaHiya's full-sized avatar

Jaime AhiyaHiya

View GitHub Profile
set -o nounset
SetupXcodeCoverage()
{
printf "*********************************\n${FUNCNAME[0]}\n"
if [[ ! -d components/XcodeCoverage/ ]]; then
cd components/
git clone https://github.com/jonreid/XcodeCoverage.git
@AhiyaHiya
AhiyaHiya / setup_openssl.sh
Last active June 2, 2019 14:30
For building OpenSSL library for macOS
#!/usr/bin/env bash
# Jaime O. Rios
# 2019-06-2
# Script will clone, config and build OpenSSL for macOS
# Script expects to be invoked from the root project directory
set -o errexit
set -o nounset
set -o pipefail
@AhiyaHiya
AhiyaHiya / create_a_box.cpp
Created June 1, 2017 13:44
Coordinates, geometry using Boost Geometry
// Jaime O. Rios
#include <boost/algorithm/clamp.hpp>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <iostream>
namespace bg = boost::geometry;
using point_t = bg::model::point< int32_t, 2, bg::cs::cartesian >;
@AhiyaHiya
AhiyaHiya / getDomainFromEmailSender
Last active July 31, 2017 20:01
AppleScript that gets URL from sender email address
tell application "Mail"
set mySelection to selection
set myMessage to item 1 of mySelection
set theSender to sender of myMessage
extract address from theSender
-- https://stackoverflow.com/questions/15670363/applescript-to-find-domain-of-the-sender-of-mail-and-add-it-to-the-rules
set theDomain to (do shell script "echo " & quoted form of rich text 1 through -2 of theSender & " | awk " & quoted form of "{split($0,a,\"@\"); print a[2]}")
display dialog theDomain
@AhiyaHiya
AhiyaHiya / setup_opencv_macos.sh
Last active October 28, 2024 03:52
Download and build OpenCV framework for macOS
#!/bin/bash
set -o errexit
set -o pipefail
set -o nounset
setup_opencv()
{
printf "*********************************\n${FUNCNAME[0]}\n"
local readonly PARENT_FOLDER=${1:-third_party}
@AhiyaHiya
AhiyaHiya / VersionString.m
Last active August 5, 2017 23:54
A function I use to update version string on the layout.
@implementation VersionStringDemo
- (void)updateVersionLabel
{
NSString* version =
[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
NSString* build =
[[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleVersionKey];
NSString* versionString = [NSString stringWithFormat:@"Version: %@ Build: %@", version, build];
@AhiyaHiya
AhiyaHiya / run_opencv_tests.sh
Created August 21, 2017 20:26
Runs OpenCV tests, which are required prior to creating pull request.
#!/bin/bash
# shell script to execute OpenCV tests prior to creating pull request
set -o errexit
set -o nounset
main()
{
cd $CURRENT_PATH/build/bin/Debug
./opencv_annotation
./opencv_createsamples
@AhiyaHiya
AhiyaHiya / AnimateUILabel.m
Created August 22, 2017 15:04
Animate UILabel... pretty simply said.
// https://stackoverflow.com/questions/3073520/animate-text-change-in-uilabel
//
- (void)animate:(UILabel*)label with:(NSString*)text
{
CATransition* animation = [CATransition animation];
animation.timingFunction =
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
animation.type = kCATransitionFade;
animation.duration = 0.75;
[label.layer addAnimation:animation forKey:@"kCATransitionFade"];
@AhiyaHiya
AhiyaHiya / keybindings.json
Created August 24, 2017 20:53
Key shortcuts to make Visual Studio Code behave more like Xcode
[
{ "key": "alt+cmd+left", "command": "editor.fold",
"when": "editorTextFocus" },
{ "key": "alt+cmd+right", "command": "editor.unfold",
"when": "editorTextFocus" },
{ "key": "cmd+alt+[", "command": "editor.action.moveLinesUpAction",
"when": "editorTextFocus" },
{ "key": "cmd+alt+]", "command": "editor.action.moveLinesDownAction",
"when": "editorTextFocus" },
@AhiyaHiya
AhiyaHiya / VersionString.swift
Created November 1, 2017 15:37
Set the version label from the plist info (iOS and macOS)
func setVersionLabel()
{
let mainBundle = Bundle.main
let version = mainBundle.infoDictionary!["CFBundleShortVersionString"] as! String
let build = mainBundle.infoDictionary![kCFBundleVersionKey as String] as! String
versionLabel.text = "Version \(version) Build: \(build)"
}