Skip to content

Instantly share code, notes, and snippets.

View angstwad's full-sized avatar

Paul Durivage angstwad

View GitHub Profile
This Gist contains the script and generated output file for an Acer B276HUL.
To "install" the output file, put it in `/System/Library/Displays/Overrides/DisplayVendorID-472`
The pre-generated file below is known to work with:
* OS X Mavericks
* OS X Yosemite
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<meta name="description" content="Trigger toasters on events">
<script src="https://code.jquery.com/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/angularjs-toaster/0.4.15/toaster.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min.js" ></script>
sudo cp /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage.original
# for Mountain Lion 10.8.3 - 10.8.4
sudo perl -pi -e 's|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61\x6C\x00{1,20})[^\x00]{9}(\x00{1,20}\x54)|$1\x00\x00\x00\x00\x00\x00\x00\x00\x00$2|sg' /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage
# for Mountain Lion 10.8.1-10.8.2 and Lion 10.7.5
#sudo perl -pi -e 's|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61\x6C\x00{1,20})[^\x00]{9}(\x00{1,20}\x4D)|$1\x00\x00\x00\x00\x00\x00\x00\x00\x00$2|sg' /System/Library/Extensions/IOAHCIFamily.kext/Contents/PlugIns/IOAHCIBlockStorage.kext/Contents/MacOS/IOAHCIBlockStorage
# for Mountain Lion 10.8.0 and Lion 10.7.4 BELOW
#sudo perl -pi -e 's|(\x52\x6F\x74\x61\x74\x69\x6F\x6E\x61\x6C\x00{1,20})[^\x00]{9}(\x00{1,20}\x51)|
@angstwad
angstwad / dtl-link.html
Last active July 12, 2016 22:07
Dare to Listen Embed Link
@angstwad
angstwad / keymap.cson
Created July 13, 2016 15:48
Atom Keymap
# These keybindings are a combination of IntelliJ's OS X 10.5+ keybindings
# and additive ones from Pivotal's practice. And extended by @andre487
# This file uses CoffeeScript Object Notation (CSON).
# If you are unfamiliar with CSON, you can read more about it here:
# https://github.com/bevry/cson#what-is-cson
#
# Project navigation
#
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.0</real>
@angstwad
angstwad / test_split_jinja_ansible.yml
Created March 31, 2014 14:24
Splitting in Jinja2/Ansible
---
- name: Test split
hosts: localhost
gather_facts: false
vars:
- facter_blockdevices: "sda,sdb,sdc,sdd,sde,sdf"
tasks:
- name: Let's split
debug: var=item
with_items: "facter_blockdevices.split(',')"
@angstwad
angstwad / set_cover_1.py
Created March 25, 2020 14:37
Snippets for Blog: Solving a Set Cover Problem in Cloud IAM on GCP
import json
from googleapiclient import discovery
# Fetch most up to date role list and role descriptions from API
iam = discovery.build('iam', 'v1')
raw_role_data = {}
# Build initial request
@angstwad
angstwad / set_cover_2.json
Created March 25, 2020 14:39
Snippets for Blog: Solving a Set Cover Problem in Cloud IAM on GCP
{
"roles/accessapproval.approver": {
"name": "roles/accessapproval.approver",
"title": "Access Approval Approver",
"description": "Ability to view or act...",
"includedPermissions": [
"accessapproval.requests.approve",
"accessapproval.requests.dismiss",
"accessapproval.requests.get",
"Accessapproval.requests.list",
@angstwad
angstwad / set_cover_3.py
Created March 25, 2020 14:42
Snippets for Blog: Solving a Set Cover Problem in Cloud IAM on GCP
import collections
roles_to_perms = collections.defaultdict(set)
perms_to_roles = collections.defaultdict(set)
perms_counts = collections.defaultdict(int)
unique_perms = set()
for role_name, role_data in raw_role_data.items():
for perm in role_data.get('includedPermissions', tuple()):
roles_to_perms[role_name].add(perm)