Skip to content

Instantly share code, notes, and snippets.

View TheLonelyGhost's full-sized avatar

David Alexander TheLonelyGhost

View GitHub Profile
@TheLonelyGhost
TheLonelyGhost / ec2_firewall_rules.rb
Last active October 6, 2015 20:44
Export EC2 Security Group firewall settings based on the private key chosen to build the instance
#!/usr/bin/env ruby
require 'bundler/inline'
gemfile true do
source 'https://rubygems.org'
gem 'aws-sdk', '~> 2'
end
require 'aws-sdk'
require 'csv'
@TheLonelyGhost
TheLonelyGhost / 4.2.5.rb
Last active February 15, 2016 15:29
Rails bug #23689
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', '4.2.5'
##########
# Tweaked Win10 Initial Setup Script
# Primary Author: Disassembler <disassembler@dasm.cz>
# Original Version: 1.4, 2016-01-16
# Tweaked based on personal preferences for @alirobe 2016-03-23 - v1.4.1
# NOTE: MAKE SURE YOU READ THIS SCRIPT CAREFULLY BEFORE RUNNING IT + ADJUST COMMENTING AS APPROPRIATE
# This script will reboot your machine when completed.
##########
# Ask for elevated permissions if required
@TheLonelyGhost
TheLonelyGhost / css_path.js
Last active July 29, 2016 13:23 — forked from asfaltboy/css_path.js
Get Element CSS Selector
/*
* Copyright (C) 2015 Pavel Savshenko
* Copyright (C) 2011 Google Inc. All rights reserved.
* Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
* Copyright (C) 2009 Joseph Pecoraro
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:

Keybase proof

I hereby claim:

  • I am thelonelyghost on github.
  • I am thelonelyghost (https://keybase.io/thelonelyghost) on keybase.
  • I have a public key ASBb1XemZCfzr3r1d8SR07egFvr_vOKeoeYaqDwz28fr4Qo

To claim this, I am signing this object:

@TheLonelyGhost
TheLonelyGhost / rcm.sh.patch
Last active December 15, 2016 20:36
Fix for hooks being run out of order in RCM
134,136c134,136
< -exec \
< sh -c 'cd "`dirname $1`" && ./"`basename $1`"' arg0 '{}' \
< \;
---
> | sort | while read file; do
> sh -c 'cd "`dirname $1`" && ./"`basename $1`"' arg0 "$file"
> done
@TheLonelyGhost
TheLonelyGhost / README.md
Last active June 12, 2019 00:17
Global state versus variable shadowing (python)

Example of Shadowing versus Global Shared State in Python

$ python ./main.py
PRE-CHANGE
First (direct): I am first
First (attribute): I am first
Second (direct): I am second
Second (attribute): I am second
CHANGE 1
@TheLonelyGhost
TheLonelyGhost / create-outlook-app.sh
Created September 9, 2021 03:29
Create electron app for outlook
#!/usr/bin/env bash
set -euo pipefail
nativefier --name Outlook --disable-dev-tools --disable-context-menu --single-instance --counter --bounce https://outlook.office.com/mail/inbox --internal-urls '.*?\.(microsoft|okta|office)\.com.*?'
@TheLonelyGhost
TheLonelyGhost / user-data-logging
Created September 9, 2021 03:31
Log user_data output to file
# Send the log output from this script to user-data.log, syslog, and the console
# From: https://alestic.com/2010/12/ec2-user-data-output/
exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1
@TheLonelyGhost
TheLonelyGhost / com.thelonelyghost.fix-jamf-firefox.plist
Created September 9, 2021 03:34
Fix ZApp injection to override Firefox settings
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.thelonelyghost.fix-jamf-firefox</string>
<key>ProgramArguments</key>
<array>
<string>/bin/zsh</string>
<string>-c</string>