Skip to content

Instantly share code, notes, and snippets.

0 - Format your external SSD as GUID partitioning using disk util on Mac
1 - Download and install VirtualBox
2 - Download Windows 10 ISO
3 - Run diskutil list and find out which is your external disk
4 - Type diskutil unmountDisk /dev/diskX where X is the number of your disk
5 - Open terminal and sudo su
6 - Run this to command to create a VirtualDisk that uses your external disk:
VBoxManage internalcommands createrawvmdk -filename "bootcamp.vmdk" -rawdisk /dev/diskX
7 - Still as root run:
/Applications/VirtualBox.app/Contents/MacOS/VirtualBox
@phackwer
phackwer / gist:80890cccf1ba3bdcb76449d3e44c11fa
Created June 15, 2018 11:14
How do I access the $scope variable in browser's console using AngularJS?
Pick an element in the HTML panel of the developer tools and type this in the console:
angular.element($0).scope()
In WebKit and Firefox, $0 is a reference to the selected DOM node in the elements tab, so by doing this you get the selected DOM node scope printed out in the console.
You can also target the scope by element ID, like so:
angular.element(document.getElementById('yourElementId')).scope()
Addons/Extensions
@phackwer
phackwer / gist:6f2e7d494f373bc1de521bceeb88361b
Last active July 16, 2018 10:19
Get user as admin/root in MacOS
sudo dscl . -merge /Groups/admin GroupMembership username
sudo dscl . -append /groups/admin GroupMembership phackwer
@phackwer
phackwer / x
Created May 25, 2018 08:57
Xcode, swift, "bootstrap" accordion with UIWebView and dynamic height according to content
You will need:
1 - ViewController
2 - Scroll View
3 - Scroll content view
4 - Button (with text and image that will be replaced when you click)
5 - WebView
6 - Greyline at the bottom
In your layout, the Webview stays between the button and the grey line, with 0 height
Requirements:
apt-get install pv original-awk
Creating:
tar cf - folder_you_will_compress -P | pv -s $(du -sb folder_you_will_compress | awk '{print $1}') | gzip > compressed_folder.tgz
Unpacking:
0 - Install supported version of docker and docker compose (in docker hosts too)
apt-get remove docker*
curl https://releases.rancher.com/install-docker/17.03.sh | sh
sudo curl -L https://github.com/docker/compose/releases/download/1.21.0/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
1 - Start your Rancher instance, locked for the outside world:
docker run -d --restart=unless-stopped --name rancher-server -p 0.0.0.0:8080:8080 rancher/server:stable
#!/bin/bash
# expected to be defined in the environment
# - AZURE_STORAGE_ACCOUNT
# - AZURE_CONTAINER_NAME
# - AZURE_ACCESS_KEY
# - CURRDATE
# - FILE_EXTENSION
# - APP_ENV
#!/bin/sh
alias errcho='>&2 echo'
if [ ! $REPO ]; then
errcho "No \$REPO to clone from;
exit 1;
fi
if [ ! $BRANCH ]; then
grep -rl $'\xEF\xBB\xBF' `pwd` > file_with_boms.txt
while read l; do sed -i '1 s/^\xef\xbb\xbf//' $l; done < file_with_boms.txt
@phackwer
phackwer / gist:e5a8b39bbd9138d6714897e1ee743afb
Created March 5, 2018 17:03
Find error in PHP files (linter)
find -type f -name "*.php" -exec php -l '{}' \;