Skip to content

Instantly share code, notes, and snippets.

@phackwer
phackwer / City Model
Created Jun 7, 2017
Laravel 5 - all cities, regions, states and countries from Gazeteer
View City Model
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class City extends Model
{
/**
* @var array
@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:58693f002acf67c1fd0c5a85e8470c36
Get the required packages before trying to install it:
apt-get install build-essential
apt-get install dkms
apt-get install linux-generic
apt-get install linux-signed-generic
Download driver at https://www.displaylink.com/downloads/file?id=1304, unzip it, chmod 777 and install as root
Now, to make sure it will not fail:
@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
View Virtual box in Ubuntu (for that cases when you need a Winbox)
In Ubuntu 16.04 LTS, after the initial install with
sudo apt install virtualbox virtualbox-guest-additions-iso virtualbox-ext-pack
I also had to:
sudo usermod -a -G vboxusers $USER
Then I could enable USB 2/3 support in the machine settings.
View gist:863246d4f05f1aa86786b59106a943fc
sudo gedit /etc/systemd/system/rc-local.service
Then add the following content to it.
[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local
[Service]
Type=forking
ExecStart=/etc/rc.local start
@phackwer
phackwer / gist:5207d76b189794d68fe37401d046b742
Last active Feb 13, 2020
Scroll on non-scrollwheel devices
View gist:5207d76b189794d68fe37401d046b742
Just install mouseemu by:
sudo apt-get install mouseemu
and edit "/etc/default/mouseemu" and add the line:
SCROLL="-scroll 56"
126 is the key scan code for the right super key. you can find other key codes by using showkey in the terminal. now restart mouseemu:
View gist:07d3da53aa33231ed4905c62d0dbee67
gsettings set org.gnome.settings-daemon.peripherals.mouse locate-pointer true
@phackwer
phackwer / gist:ef2819332f9c5a1d7572c7ada1e68b89
Created Dec 11, 2019
SonarQube on Docker and local scanner
View gist:ef2819332f9c5a1d7572c7ada1e68b89
# SONAR QUBE SERVER RUN
docker run --rm \
-p 9000:9000 \
-v sonarqube_conf:/opt/sonarqube/conf \
-v sonarqube_extensions:/opt/sonarqube/extensions \
-v sonarqube_logs:/opt/sonarqube/logs \
-v sonarqube_data:/opt/sonarqube/data \
sonarqube
View gist:a9749318b21a003e63adcf25b579a0d3
sudo apt-get install libmtdev xserver-xorg-dev
git clone https://github.com/p2rkw/xf86-input-mtrack/
cd xf86-input-mtrack
./configure
sudo make installsudo ln -s /usr/local/lib/xorg/modules/input/* /usr/lib/xorg/modules/input/
Add to xorg.conf
Section "InputClass"
MatchIsTouchpad "on"