Skip to content

Instantly share code, notes, and snippets.

View MacsInSpace's full-sized avatar

Craig Hair MacsInSpace

  • Department of Education
  • Melbourne
  • 09:14 (UTC +11:00)
View GitHub Profile
@MacsInSpace
MacsInSpace / set_proxy.ps1
Created August 12, 2024 02:54 — forked from harmakhis971/set_proxy.ps1
powershell set default proxy for `Invoke-WebRequest`
# set to system default proxy
[System.Net.WebRequest]::DefaultWebProxy = [System.Net.WebRequest]::GetSystemWebProxy()
[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
# or a custom one
[System.Net.WebRequest]::DefaultWebProxy = New-Object System.Net.WebProxy("http://localhost:8080")
# or use username and password auth
[System.Net.WebRequest]::DefaultWebProxy = New-Object System.Net.WebProxy("http://localhost:8080",$true)
[System.Net.WebRequest]::DefaultWebProxy.Credentials = New-Object System.Net.NetworkCredential($user, $passwd)
@MacsInSpace
MacsInSpace / install-homebrew-osx.sh
Created October 22, 2021 00:52 — forked from abn/install-homebrew-osx.sh
Install homebrew from behind a proxy on Mac OS X.
#!/usr/bin/env bash
# Based on: http://godlessheathenmemoirs.blogspot.com.au/2015/03/homebrew-aka-brew-on-mac-os-x-behind.html
function usage() {
echo 2>&1 ""
echo 2>&1 "usage: $(basename $0) PROXY_HOST PROXY_PORT"
exit 1
}
PROXY_HOST=${PROXY_HOST:-$1}
@MacsInSpace
MacsInSpace / xcode-cli-tools.sh
Last active June 17, 2020 05:27 — forked from trinitronx/xcode-cli-tools.sh
Script to download & install XCode Command Line tools on OSX 10.7 or 10.8. Lifted from jedi4ever/veewee template.
#!/bin/sh
OSX_VERS=$(sw_vers -productVersion | awk -F "." '{print $2}')
# Get Xcode CLI tools
# https://devimages.apple.com.edgekey.net/downloads/xcode/simulators/index-3905972D-B609-49CE-8D06-51ADC78E07BC.dvtdownloadableindex
# https://developer.apple.com/downloads/index.action
TOOLS=clitools.dmg
if [ ! -f "$TOOLS" ]; then
if [ "$OSX_VERS" -eq 7 ]; then
DMGURL=http://devimages.apple.com/downloads/xcode/command_line_tools_for_xcode_os_x_lion_april_2013.dmg
@MacsInSpace
MacsInSpace / install-xcode-cli-tools.sh
Last active June 29, 2023 04:59 — forked from mokagio/install-xcode-cli-tools.sh
Install Xcode CLI Tools without GUI
#!/bin/bash
# See http://apple.stackexchange.com/questions/107307/how-can-i-install-the-command-line-tools-completely-from-the-command-line
echo "Checking Xcode CLI tools"
# Only run if the tools are not installed yet
# To check that try to print the SDK path
xcode-select -p &> /dev/null
if [ $? -ne 0 ]; then
echo "Xcode CLI tools not found. Installing them..."
@MacsInSpace
MacsInSpace / Gist
Last active April 28, 2019 23:39 — forked from jbnunn/Gist
Install Google Chrome from Powershell
$LocalTempDir = $env:TEMP; $ChromeInstaller = "ChromeInstaller.exe"; (new-object System.Net.WebClient).DownloadFile('http://dl.google.com/chrome/install/375.126/chrome_installer.exe', "$LocalTempDir\$ChromeInstaller"); & "$LocalTempDir\$ChromeInstaller" /silent /install; $Process2Monitor = "ChromeInstaller"; Do { $ProcessesFound = Get-Process | ?{$Process2Monitor -contains $_.Name} | Select-Object -ExpandProperty Name; If ($ProcessesFound) { "Still running: $($ProcessesFound -join ', ')" | Write-Host; Start-Sleep -Seconds 2 } else { rm "$LocalTempDir\$ChromeInstaller" -ErrorAction SilentlyContinue -Verbose } } Until (!$ProcessesFound)