Skip to content

Instantly share code, notes, and snippets.

View gregorynicholas's full-sized avatar
💀
alter.

gregory nicholas gregorynicholas

💀
alter.
View GitHub Profile
@gregorynicholas
gregorynicholas / rank_metrics.py
Created March 19, 2020 08:00 — forked from bwhite/rank_metrics.py
Ranking Metrics
"""Information Retrieval metrics
Useful Resources:
http://www.cs.utexas.edu/~mooney/ir-course/slides/Evaluation.ppt
http://www.nii.ac.jp/TechReports/05-014E.pdf
http://www.stanford.edu/class/cs276/handouts/EvaluationNew-handout-6-per.pdf
http://hal.archives-ouvertes.fr/docs/00/72/67/60/PDF/07-busa-fekete.pdf
Learning to Rank for Information Retrieval (Tie-Yan Liu)
"""
import numpy as np
@gregorynicholas
gregorynicholas / GCalUtils.md
Created November 17, 2019 07:42 — forked from mogsdad/GCalUtils.md
Collection of Google Calendar related utility functions for Google Apps Script.

Google Calendar Utilities

getEventsWithGuest

Gets all events that occur within a given time range, and that include the specified guest email in the guest list.

###Parameters:###

@gregorynicholas
gregorynicholas / convertSheet2Json.gs
Created November 17, 2019 07:42 — forked from daichan4649/convertSheet2Json.gs
spreadsheet のデータを JSON として読み込む(Google Apps Script)
function convertSheet2Json(sheet) {
// first line(title)
var firstRange = sheet.getRange(1, 1, 1, sheet.getLastColumn());
var firstRowValues = firstRange.getValues();
var titleColumns = firstRowValues[0];
// after the second line(data)
var lastRow = sheet.getLastRow();
var rowValues = [];
for(var rowIndex=2; rowIndex<=lastRow; rowIndex++) {
@gregorynicholas
gregorynicholas / pullJSON.js
Created November 17, 2019 07:42 — forked from varun-raj/pullJSON.js
Google App Script To Fetch Data From JSON Webservice and Write them to google spreadsheet.
function pullJSON() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheets = ss.getSheets();
var sheet = ss.getActiveSheet();
var url="http://example.com/feeds?type=json"; // Paste your JSON URL here
var response = UrlFetchApp.fetch(url); // get feed
var dataAll = JSON.parse(response.getContentText()); //
#!/usr/bin/env python
# To look at: https://github.com/kcrawford/mac-network/blob/master/lib/mac-network/wifi.rb
# To look at: https://stackoverflow.com/questions/28096630/mac-os-x-10-10-reorder-preferred-networks
'''
Playing around with CoreWLAN to return information about the wi-fi connection
Documentation:
https://developer.apple.com/library/mac/documentation/CoreWLAN/Reference/CWInterface_reference/translated_content/CWInterface.html
@gregorynicholas
gregorynicholas / marketing.py
Created October 3, 2019 22:37 — forked from pudquick/marketing.py
Using PrivateFrameworks to get marketing model information for Apple Macs without hitting their internet API (where possible) via python and pyobjc
# Tested on 10.11
# Note:
# The marketing information embedded in the ServerInformation.framework is not the same as what
# About This Mac displays - there are differences.
#
# For example:
# ServerInformation: 15" MacBook Pro with Retina display (Mid 2015)
# About This Mac: MacBook Pro (Retina, 15-inch, Mid 2015)
#
@gregorynicholas
gregorynicholas / make_firmwareupdater_pkg.sh
Created October 3, 2019 22:37 — forked from erikng/make_firmwareupdater_pkg.sh
Make standalone "universal" FirmwareUpdater package for High Sierra
#!/bin/sh
# Based on investigations and work by Pepijn Bruienne
# Expects a single /Applications/Install macOS Sierra*.app on disk
# Adapted from https://gist.github.com/gregneagle/7c802aef636ac4295536f2e360921bb1
IDENTIFIER="com.foo.FirmwareUpdateStandalone"
VERSION=1.0
# find the Install macOS Sierra.app and mount the embedded InstallESD disk image
echo "Mounting Sierra ESD disk image..."
@gregorynicholas
gregorynicholas / seedutil.md
Created October 3, 2019 22:36 — forked from pookjw/seedutil.md
Enroll macOS Beta Seed without profile installation

seedutil

Enroll macOS Beta Seed without profile installation

Usage

$ sudo /System/Library/PrivateFrameworks/Seeding.framework/Versions/A/Resources/seedutil 
usage: seedutil enroll SEED_PROGRAM
    seedutil unenroll

seedutil current

@gregorynicholas
gregorynicholas / Installation.md
Created October 3, 2019 22:36 — forked from albertbori/Installation.md
Automatically disable Wifi when an Ethernet connection (cable) is plugged in on a Mac

Overview

This is a bash script that will automatically turn your wifi off if you connect your computer to an ethernet connection and turn wifi back on when you unplug your ethernet cable/adapter. If you decide to turn wifi on for whatever reason, it will remember that choice. This was improvised from this mac hint to work with Yosemite, and without hard-coding the adapter names. It's supposed to support growl, but I didn't check that part. I did, however, add OSX notification center support. Feel free to fork and fix any issues you encounter.

Most the credit for these changes go to Dave Holland.

Requirements

  • Mac OSX 10+
  • Administrator privileges
@gregorynicholas
gregorynicholas / Example.scpt
Created October 3, 2019 22:35 — forked from pudquick/Example.scpt
Make DMGs from folders
property destination_for_dmgs : "/Users/mike/Desktop"
on open the_items
repeat with an_item in the_items
set the_info to info for an_item
if kind of the_info is "Folder" then
set dmg_path to quoted form of (destination_for_dmgs & "/" & (name of the_info) & ".dmg")
set src_path to quoted form of POSIX path of an_item
set vol_name to quoted form of (name of the_info)
set command_str to "hdiutil create " & dmg_path & " -volname " & vol_name & " -srcfolder " & src_path