Skip to content

Instantly share code, notes, and snippets.

View hugoeanogueira's full-sized avatar

Hugo Nogueira hugoeanogueira

View GitHub Profile
@hugoeanogueira
hugoeanogueira / playwright_chrome_throttling.ts
Created January 11, 2024 09:44
Configure Network and CPU throttling to Chrome using Playwright
// ENABLE THROTTLING IN CHROME WITH PLAYWRIGHT
// https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-emulateNetworkConditions
// https://chromedevtools.github.io/devtools-protocol/tot/Emulation/#method-setCPUThrottlingRate
const cdpSession = await context.newCDPSession(page);
await cdpSession.send("Network.emulateNetworkConditions", {
downloadThroughput: 2_000_000 / 8, // 2 mbps
uploadThroughput: 2_000_000 / 8, // 2 mbps
latency: 100, // 100 ms
offline: false,
@hugoeanogueira
hugoeanogueira / add_service_systemd.md
Last active July 18, 2019 20:52
Running services on boot using systemd

systemd

Add an entry in systemd for your service, adding the following file to /lib/systemd/system/steinway.service.

[Unit]
Description=Example node JS app
Documentation=https://www.example.com
After=network.target
@hugoeanogueira
hugoeanogueira / gcloud_ssh_complete
Created November 13, 2017 14:45 — forked from miquelbar/gcloud_ssh_complete
Gcloud ssh autocomplete
#!/bin/bash
export _SSH_COMPLETE_F_CACHE="/tmp/_ssh_complete"
export _SSH_COMPLETE_HOSTS=""
[[ ! -f "$_SSH_COMPLETE_F_CACHE" ]] && touch "$_SSH_COMPLETE_F_CACHE"
_ssh_complete() {
if [ -z "$_SSH_COMPLETE_HOSTS" ]; then
@hugoeanogueira
hugoeanogueira / install_mac_virtualbox.txt
Last active April 25, 2017 22:11
Install MacOS in Virtualbox (Mac)
# FULL INSTRUCTIONS IN:
http://www.starkandwayne.com/blog/running-a-mac-vm-on-a-mac-using-virtualbox/
---------------------------------------------
# make sure you have iesd installed
gem install iesd
# create fixed image
iesd -i "/Applications/Install OS X Yosemite.app" -o yosemite.dmg -t BaseSystem
@hugoeanogueira
hugoeanogueira / minikube.md
Created February 1, 2017 12:10 — forked from codesword/minikube.md
Installing minikube using xhyve driver

###Install docker-machine-driver-xhyve docker-machine-driver-xhyve is a docker machine driver plugin for xhyve native OS X Hypervisor. xhyve is a lightweight OS X virtualization solution. In my opinion, it's a far better option than virtualbox for running minikube. ####Brew On MacOS sierra, download latest using

brew install docker-machine-driver-xhyve --HEAD
sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
@hugoeanogueira
hugoeanogueira / douchebag-vertical-align.css
Created November 9, 2016 10:48 — forked from colintoh/douchebag-vertical-align.css
douchebag way of vertical alignment
.element {
position: relative;
top: 50%;
transform: translateY(-50%);
}
@hugoeanogueira
hugoeanogueira / nginx.conf
Created October 14, 2015 14:15 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
# Generate SSL Certificate for dev
export DOMAIN="example.dev"
export PASSPHRASE=$(head -c 500 /dev/urandom | tr -dc a-z0-9A-Z | head -c 128; echo)
export SUBJ="
C=PT
ST=Aveiro
O=Example Organization
localityName=Aveiro
commonName=$DOMAIN
server {
listen 80;
listen [::]:80;
server_name yourserver.com;
root /path/to/your/htdocs;
error_page 404 /404.html
index index.html;
### Keybase proof
I hereby claim:
* I am hugoeanogueira on github.
* I am hugoeanogueira (https://keybase.io/hugoeanogueira) on keybase.
* I have a public key whose fingerprint is F1DA C16E 5829 A6D3 56E4 CD0C A3F6 5C83 3670 5F4E
To claim this, I am signing this object: