Instantly share code, notes, and snippets.

# Ander Moranandermoran

• Sort options
Last active Aug 20, 2019
Programmatically read and change the brightness on macOS
View changeMacBrightness.m
 #import #import #import // this helped me out a lot <3: https://stackoverflow.com/questions/3239749/programmatically-change-mac-display-brightness int main(int argc, char *argv[]) { io_iterator_t iterator; kern_return_t result = IOServiceGetMatchingServices(kIOMasterPortDefault, IOServiceMatching("IODisplayConnect"), &iterator);
Created Mar 16, 2019
A small program that grabs the information of every contact on a user's mac
View contact_reaper.py
 import plistlib import os import sys import getpass # usage: python contact_reaper.py or python3 contact_reaper.py # tested on macOS Mojave (10.14) def get_main_dir_path(): return "/Users/" + getpass.getuser() + "/Library/Application Support/AddressBook/Sources/"
Created Oct 26, 2018
Calculate a person's height given a size of their bone, race, sex, and age
View bones.py
 bone_coefficient = -1; addition_constant = -1; error_margin = -1; bone_length = -1; bone_coefficients = [[[0 for col in range(2)]for row in range(3)] for x in range(6)] # Femur bone_coefficients[0][0][0] = 2.32 bone_coefficients[0][0][1] = 2.47 bone_coefficients[0][1][0] = 2.10
Created Jul 21, 2017
A program that finds the total resistance of n parallel resistors
View calculateParallelResistance.py
 #!/usr/bin/python import numbers def findDivisor(num): # 2,3 are the most common divisor for many numbers hence going by divisor of 2,3 can be quicker # if not then by the same number as divisor if num%2 == 0: return 2 elif num%3==0: return 3
Created Apr 18, 2017
All knowing artificial intelligence ;)
View Omni.cpp
 #include #include #include #include #include using namespace std; bool enabled; int getch() {
Created Apr 12, 2017
Allows sending of an iMessage thru terminal. Can't send message to self, yet...
View sendMessageThruTerminal.sh
 #!/bin/sh USAGE=\$'Usage: imessage \nExample: message 9121231234 \"Hello!\"' if [ "\$#" -ne "2" ]; then echo "\$USAGE" exit 1; fi exec <"\$0" || exit; for i in {1..12} # Reads the first x lines of the program do read v
Created Mar 18, 2017
Ways to evaluate boolean expressions in c++
View Conditional techniques
 #include #include using namespace std; int main(int argc, char *argv[]) { bool b = true; // High school level if (true) { cout << "simple conditional" << endl; }
Created Jan 2, 2017
grabs user's phone number (works on el capitan)
View grabnumber.cpp
 #include #include #include #include #include #include #include #include #include #include
Created Nov 28, 2016