Skip to content

Instantly share code, notes, and snippets.

@phackwer
phackwer / gist:9f9db7bc95396a48b240f5c3a42cf944
Last active Aug 17, 2020
Undervolting linux ubuntu 18.04 (XPS 9570 i9 32GB RAM)
View gist:9f9db7bc95396a48b240f5c3a42cf944
Very useful for the i9 XPS 9570 overheating on Linux. Since I use Linux for development, I don't use the nvidia that comes
with the note and also don't need turboboost enabled, even running dozens of docker containers. I was having problems with
temperature. Notebook was getting so hot it was hard to type for more than 4 hours straight.
Here are my temperatures before undevolting:
phackwer@phackwer-XPS-15-9570 ~/P/p/poc> sensors
coretemp-isa-0000
Adapter: ISA adapter
Package id 0: +53.0°C (high = +100.0°C, crit = +100.0°C)
View gist:af450e008ab073d90e832f7e7ffafb84
https://medium.com/@tomwwright/better-battery-life-on-ubuntu-17-10-4588b7f72def
https://www.dell.com/community/Inspiron/Suspend-resume-problems-on-Ubuntu-18-04/td-p/6072410
https://github.com/iberianpig/fusuma
https://martys.typepad.com/blog/2015/08/3-finger-drag-on-linux.html
https://askubuntu.com/questions/744364/displaylink-asus-mb168b-issues
@phackwer
phackwer / gist:87deef5def375867fb4875e05e838e90
Created Nov 17, 2018
Windows on external SSD on Macbook
View gist:87deef5def375867fb4875e05e838e90
DISCLAIMER: If you found this article you are either me (duh) or clever enough to use Google to find it and find all missing
pieces of information that you are still not aware about. I DON'T DO FREE SUPPORT OTHER THAN WHAT I NEED TO MYSELF AND MAKE
PUBLICLY AVAILABLE!
1 - Install Virtual Box, get an ISO copy of windows installation and open Bootcamp on Mac (Action > Download drivers) to get
the drivers for windows
2 - Create a "ramdisk" that will actually point to your external ssd. For this you need to know the disk (you
can simply type mount on terminal and figure out the disk number by yourself). After you know the number, type this in
terminal:
@phackwer
phackwer / gist:320e59b3c1569debeb07dc825c7e8df6
Created Sep 19, 2018
Higher resolution by scaling on low resolution screes
View gist:320e59b3c1569debeb07dc825c7e8df6
phackwer@phackwer-X540SA ~> xrandr --output eDP-1 --mode 1366x768 --scale-from 1650x900 --panning 1650x900
phackwer@phackwer-X540SA ~> xrandr --output eDP-1 --mode 1366x768 --scale-from 1920x1080 --panning 1920x1080
@phackwer
phackwer / gist:5b5628aff011eb853639d35613b625ce
Last active May 12, 2020
Remove purple from Ubuntu 16.04
View gist:5b5628aff011eb853639d35613b625ce
Remove grub background color:
16.04 and later:
sudo -H gedit /usr/share/plymouth/themes/ubuntu-logo/ubuntu-logo.grub
17.10 and later:
sudo -H gedit /usr/share/plymouth/themes/default.grub
@phackwer
phackwer / Rancher.md
Created Sep 12, 2018 — forked from lmmendes/Rancher.md
Running Rancher locally (with two hosts) using MacOS Docker and VirtualBox
View Rancher.md

Rancher

Rancher is an open source project that provides a complete platform for operating Docker in production. It provides infrastructure services such as multi-host networking, global and local load balancing, and volume snapshots.

This documentation describes how to run Rancher localy for development and evaluation propuses.

I'm using Docker for OSX (native) but even for this to work you will need to install VirtualBox.

Launching Management Rancher Server

View Windows on SSD on Macbook
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 Jun 15, 2018
How do I access the $scope variable in browser's console using AngularJS?
View gist:80890cccf1ba3bdcb76449d3e44c11fa
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 Jul 16, 2018
Get user as admin/root in MacOS
View gist:6f2e7d494f373bc1de521bceeb88361b
sudo dscl . -merge /Groups/admin GroupMembership username
sudo dscl . -append /groups/admin GroupMembership phackwer
@phackwer
phackwer / x
Created May 25, 2018
Xcode, swift, "bootstrap" accordion with UIWebView and dynamic height according to content
View x
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