Skip to content

Instantly share code, notes, and snippets.

View AhiyaHiya's full-sized avatar

Jaime AhiyaHiya

View GitHub Profile
@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 / 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 / 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
set -o nounset
SetupXcodeCoverage()
{
printf "*********************************\n${FUNCNAME[0]}\n"
if [[ ! -d components/XcodeCoverage/ ]]; then
cd components/
git clone https://github.com/jonreid/XcodeCoverage.git
set -o nounset
SetupIntelTBB()
{
printf "*********************************\n${FUNCNAME[0]}\n"
if [[ ! -d $CURRENT_PATH/components/intel/tbb ]]; then
mkdir -p $CURRENT_PATH/components/intel/tbb
fi
set -o nounset
SetupCatch()
{
printf "*********************************\n${FUNCNAME[0]}\n"
if [[ ! -d components/catch/ ]]; then
mkdir -p components/catch/include/
cd components/catch/include/
#!/bin/bash
set -o errexit
set -o pipefail
set -o nounset
# Inspired by
# https://github.com/mgrebenets/boost-xcode5-iosx/blob/master/boost.sh
download_boost() {
printf "*********************************\\n%s\\n" "${FUNCNAME[0]}"
@AhiyaHiya
AhiyaHiya / .shared_aliases
Last active November 17, 2017 15:53
My favorites aliases for both bash and zsh (oh my zsh)
#
# For both zsh and bash
#
#####################
# Cool terminal notification app but message only works with single quote
alias tnot="terminal-notifier -message "
#####################
# clang-format
# script expects to be at the root folder where ROSE was already downloaded
# so if you:
# mkdir ROSE
# cd ROSE
# git clone https://github.com/rose-compiler/rose .
# This script should be in the ROSE folder
set -o errexit
set -o pipefail
set -o nounset
/*
Losely based on http://stackoverflow.com/questions/18154630/c-see-if-argument-is-numeric
and other related answers on stackoverflow.com
*/
auto IsNumber(const std::string& maybeNumber) -> bool
{
auto decimal = false;
for (char c : maybeNumber)
{
if (c == '.' && !decimal)