Category: Nerd Stuff

Upgrading ElementalX, Android and Magisk on Google Pixel 2 on MacOS X

This is almost for sure the wrong way to do things, but this is my current process (as of apr 22, 2018) to upgrade my phone when new android releases are out, and/or new elemental x.

UPDATE TO LATEST FULL RELEASE OF ANDROID:

***IMPORTANT: REMOVE ‘-w’ from the ‘fastboot update’ line in the flash-all.sh (this will stop it from wiping the device).

  • Make sure you have already downloaded the latest Magisk ZIP (should be under ‘/sdcard/MagiskManager’, ex. ‘Magisk-v15.2.zip’)
  • Power off device
  • unzip the image.zip file
    # unzip image-walleye-opm2.171019.029.b1.zip
  • Boot the device into fastboot (power + down)
  • Run flash-all.sh
    # flash-all.sh
  • Let phone boot into the OS
  • Power off
  • Boot the device into fastboot (power + down)
  • Then, boot twrp
    # fastboot boot *TWRP.img path*
  • put in your password for twrp encryption and let it load into TWRP
  • now push your files to your pixel 2
    # adb push ElementalX-P2-1.05.zip /sdcard/Download
    # adb push Magisk-VERSION.zip /sdcard/Download
    # adb push /latest/release/boot.img /sdcard/Download
  • now click install, and install your files. install magisk and elementalx
  • wipe dalvik and cache, then reboot to system
  • open magisk check if rooted
  • if not, then install, patch boot file, pick boot.img and then
    # adb pull /sdcard/MagiskManager/patched_boot.img
    # adb reboot bootloader
    # fastboot flash boot patched_boot.img
    # fastboot reboot
  • Reboot the phone

TO UPGRADE ELEMENTAL X:

Perform the same steps as above, but just do the elementalX portion.

 

If anyone knows a better, quicker, way please let me know cause this is kinda annoying 🙂

Radeon RX 580 on Hackintosh OSX 10.13.4 Automatically Rotate Screen on Boot

Recently I got an ASUS Radeon RX 580 to replace an NVidia Card I was tired of fighting and trying to make work properly. As it turns out, no video card is very easy to get working with Hackintosh!

Anyway, today the problem was after finally getting two monitors working the secondary monitor was booting with a weird rotation and was a pain in the ass to change each time I logged in because the mouse was about 5″ off location on that screen.

There must be a way to automate it, thought I.

Here’s how I did it.

# cd ~/Documents/Source
# git clone https://github.com/CdLbB/fb-rotate.git
# cd fb-rotate
# gcc -w -o fb-rotate fb-rotate.c -framework IOKit -framework ApplicationServices
# nano /Users/YOURUSERNAME/Library/LaunchAgents/com.blofeld.fb-rotate.plist

put this

<?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.YOURUSERNAME.fb-rotate</string>
 <key>ProgramArguments</key>
 <array>
 <string>/Users/YOURUSERNAME/Documents/Source/rotate.sh</string>
 </array>
 <key>RunAtLoad</key>
 <true/>
</dict>
</plist>

then get the list of your screens

# /Users/YOURUSERNAME/Documents/Source/fb-rotate/fb-rotate -l

Which will output something like this

Display ID Resolution
 0xb430e32 1920x1080 [main display]
 0x2b287c4c 1200x1920

Take note of the screen you want to automatically rotate on boot. Copy the 0x00000 number.

# nano ~/Documents/Source/rotate.sh

And put fb-rotate command into the file

/Users/YOURUSERNAME/Documents/Source/fb-rotate/fb-rotate -d 0X_YOURIDHERE -r 0
/Users/YOURUSERNAME/Documents/Source/fb-rotate/fb-rotate -d 0X_YOURIDHERE -r 270

then make it executable

chmod +x ~/Documents/Source/rotate.sh

Now on your next reboot, it should auto flip your monitor the orientation you want. Obviously not a super elegant solution, but, whatever it’s done right, and, it work

If you want to test your scripts here they are testing:

to load:

launchctl load com.YOURUSERNAME.fb-rotate

to unload:

launchctl unload com.YOURUSERNAME.fb-rotate.plist

Howto: Ricing Mac OS-X with Zsh, Iterm2 Borderless + Padding, TMux and KWM

This past weekend I saw over on /r/unixporn that ricing Mac OSX is a ‘thing’. I used to have a lot of fun doing this on my old linux systems when I was a kid, like Enlightenment, Afterstep, Windowmaker, XFCE, and anything else I could customize to look like something from a cool ‘hacker movie’ or something like that.

Anyway, this got me inspired to change my desktop into something a little cooler looking than standard OSX and here’s the basic premise of everything I did.

First, you’re going to want to install Brew, which is a package management system that’ll let you install additional software on your mac in a nicely controlled and updatable manner.

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Now that brew is installed, we can run through the rest of the basic setup to get this going.

What I did first, was change the default shell from Bash over to Zsh, which you can see the differences here if you’re interested

 brew install zsh
 nano /etc/shells
 add
 /usr/local/bin/zsh
 sudo dscl . -create /Users/<YOURUSERNAME> UserShell /usr/local/bin/zsh
 sudo dscl . -create /Users/hugodrax UserShell /usr/local/bin/zsh

now check to make sure it’s set properly

 dscl . -read /Users/$USER UserShell
 or
 echo $SHELL

copy this in to your .zshrc

 HISTFILE=~/.histfile
 HISTSIZE=20000
 SAVEHIST=1000
 setopt notify
 bindkey -e
 zstyle :compinstall filename '/Users/hugodrax/.zshrc'
 autoload -Uz compinit
 compinit
 autoload -U colors && colors
 PS1="%{$fg[cyan]%}%n%{$reset_color%} %{$fg[white]%}%~ %{$reset_color%}%% "
 # ALIASES
 alias ls='ls -G'

Now, let’s install instantly awesome Zsh

 cd ~/Documents/Source/
 git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"
 setopt EXTENDED_GLOB
 for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
 ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
 done

then, lets change the prompt

 prompt -l
 prompt -p kylewest
 prompt kylewest

then make it permanant

 nano ~/.zpreztorc

and change

 zstyle ':prezto:module:prompt' theme 'sorin'

to

 zstyle ':prezto:module:prompt' theme 'kylewest'

also, scroll to the second to last line and uncomment the iterm2 integration in the same file, then exit and save. Now, you should be able to start up Iterm2 and you’re running Zsh in there instead of bash.

Now, lets install tmux, a wonderful GNU Screen replacement

git clone https://github.com/tony/tmux-config.git ~/.tmux
ln -s ~/.tmux/.tmux.conf ~/.tmux.conf
cd ~/.tmux
git submodule init
git submodule update
cd ~/.tmux/vendor/tmux-mem-cpu-load
cmake .
make
sudo make install
cd ~
git clone https://github.com/powerline/fonts.git fonts
cd ~/fonts 
pip install --user powerline-status
cd ..
git clone https://github.com/kovidgoyal/powerline-daemon.git pld
cd ~/pld 
gcc -O3 powerline-client.c -o powerline-client
chmod +x powerline-daemon
powerline-daemon
sudo cp powerline-client powerline-daemon /usr/local/bin
sudo apt-get install powerline
then add this to tmux.conf
nano ~/.tmux.conf

if-shell 'test -f ~/.local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf' 'source-file ~/.local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf'
Then change your font in ITerm2 to be a -powerline font and all should look nice.

So, next we’re going to want to install a customized version of Iterm2 to accommodating padding , and borderless which looks much cooler 🙂

So in our terminal we’ll go

 cd ~/Documents/
 mkdir Source && cd Source
 git clone https://github.com/jaredculp/iterm2-borderless-padding.git iterm2-borderless-padding
 cd iterm2-borderless-padding
 ./install.sh 20 20
 mv ./iTerm2/build/Development/iTerm2.app /Applications/

Now, re-open Iterm2 and you’ll have a zsh shell with colorized ls output, running in a borderless window with 20 pixels padding on all edges. Don’t forget to change your font to one of the -powerline fonts, and try out tmux too!

Then, we’ll install KWM which is a nice tiling window manager.

 brew install koekeishiya/kwm/kwm
 mkdir -p ~/.kwm
 cp /usr/local/Cellar/kwm/3.0.7/kwmrc ~/.kwm/kwmrc
 brew services start koekeishiya/kwm/kwm

now you can reboot, and you should be good to go.

After rebooting, you’ll probably want to modify your KWMrc file to your liking, here’s a good starting point.

Here’s a screenshot since they’re cool and stuff [some of it is obfuscated fyi];

ss