Skip to content

Instantly share code, notes, and snippets.

View alex-ross's full-sized avatar

Alexander Ross alex-ross

View GitHub Profile
@alex-ross
alex-ross / [email protected]
Created November 12, 2021 21:50
Elasticsearch 5.6 on macOS arm64
class ElasticsearchAT56 < Formula
desc "Distributed search & analytics engine"
homepage "https://www.elastic.co/products/elasticsearch"
url "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.4.tar.gz"
sha256 "1098fc776fae8c74e65f8e17cf2ea244c1d07c4e6711340c9bb9f6df56aa45b0"
head do
url "https://github.com/elasticsearch/elasticsearch.git"
depends_on "gradle" => :build
end
@alex-ross
alex-ross / macOSHighSierra_Bootable.sh
Last active August 2, 2019 23:21
Create a Bootable macOSHighSierra.iso for installing macOS High Sierra in Virtualbox or VMware with macOS High Sierra.app
# Create a Bootable macOSHighSierra.iso for installing macOS High Sierra in Virtualbox or VMware with macOS High Sierra.app
# Create a "virtual USB flash drive"/disk image:
hdiutil create -o /tmp/HighSierra -size 8G -layout SPUD -fs HFS+J -type SPARSE
# Mount it:
hdiutil attach /tmp/HighSierra.sparseimage -noverify -mountpoint /Volumes/install_build
# Write the installer files into this new disk image:
@alex-ross
alex-ross / Gemfile
Last active December 26, 2018 20:18
Nanobox + Capybara + Rails + RSpec
# Gemfile
group :development, :test do
gem 'rspec-rails'
gem "capybara"
gem "selenium-webdriver"
end

Note

Apple will reject apps that are using private url schemes (Ugh, Apple....) if they are pretty much obvius. Some apps are rejected and others are not, so, be aware of this issue before implementing any of those URL's in your app as a feature.

Updates

  • [UPDATE 4] iOS 10 update: apparently settings now can be reached using App-Pref instead of prefs
  • [UPDATE 3] For now you just can use url schemes to open your apps's settings with Swift 3.0 (Xcode 8). I'll keep you informed when OS preferences can be reached
  • [UPDATE 2] The openURL() method of UIApplication is now deprecated. You should use application(_:open:options:) instead
  • [UPDATE 1] Not yet tested in iOS 10. It will fail because of policies changes in URL scheme handling.
@alex-ross
alex-ross / mysql-docker.sh
Created August 3, 2017 08:13 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE

Keybase proof

I hereby claim:

  • I am alex-ross on github.
  • I am aross (https://keybase.io/aross) on keybase.
  • I have a public key ASDPyzK_ROGPT4kF1IsoOIG3qMx4xOw3gme-3bbRElnEwgo

To claim this, I am signing this object:

-- 1. Place in ~/Library/Scripts and enable the Applescript menu via the Applescript Editor
-- 2. Substitute "vpn.example.com" and "redacted" for your VPN server and password
-- 3. Open Security & Privacy System Preferences, go to Privacy, Accessibility
-- 4. Enable Applescript Editor and System UI Server
-- 5. Trigger script from the menu
-- 6. Enjoy being connected
tell application "Cisco AnyConnect Secure Mobility Client"
activate
end tell
@alex-ross
alex-ross / integration_example.rb
Last active August 29, 2015 14:06
Integration example that allows multiple sessions at same time
require "test_helper"
class CompaniesTest < ActionDispatch::IntegrationTest
it "admin can signin and visit companies" do
admin = new_session_as :admin
admin.goes_to "/companies"
end
private
@alex-ross
alex-ross / app.rb
Created May 10, 2014 20:27
Simple rack application. Start with `rackup`
class App
def self.call(env)
path = env["REQUEST_PATH"]
case path
when "/"
body = "<h1>Hello,</h1><p>world!</p>"
[200, {}, [body]]
else
body = "Couldn't find any page at #{path}"
[400, {}, [body]]
#!/usr/bin/env ruby
require 'gosu' # gem install gosu --no-document
include Gosu
$dimension, $splits = 200, 20
$size = $dimension.to_f / $splits.to_f
class Worm
attr_writer :dir
def initialize() reset end