Skip to content

Instantly share code, notes, and snippets.

sudo scutil --set ComputerName "$1" && \
sudo scutil --set HostName "$1" && \
sudo scutil --set LocalHostName "$1" && \
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "$1"
BACKGROUND="/Library/Desktop Pictures/Solid Colors/Solid Aqua Blue.png"
sqlite3 ~/Library/Application\ Support/Dock/desktoppicture.db "update data set value = '$BACKGROUND'" && killall Dock
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BackgroundColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKMHCA9VJG51bGzTCQoLDA0OV05TV2hpdGVcTlNDb2xvclNwYWNlViRjbGFzc00w
IDAuODk5OTk5OTgAEAOAAtIQERITWiRjbGFzc25hbWVYJGNsYXNzZXNXTlNDb2xvcqIS
FFhOU09iamVjdF8QD05TS2V5ZWRBcmNoaXZlctEXGFRyb290gAEIERojLTI3O0FIUF1k
#!/bin/bash
# dependencies: curl, jq
# usage ./psi.sh "https://www.google.com" 90 mobile
BASEURL=https://www.googleapis.com/pagespeedonline/v4/runPagespeed
url=$1
threshold=$2
strategy=${3:-desktop}
docker run -v $(pwd):/work mnuessler/pdftk A=first.pdf B=second.pdf shuffle A B output collated_pages.pdf
@csabapalfi
csabapalfi / web-perf-like-its-2017.md
Last active October 20, 2017 22:27
Web perf like it's 2017

Csaba Palfi - Web perf like it's 2017

Everything is changing so fast: new devices, JS framework of the day, the expectations of our users. How do we respond?

What's the current state of the art in web performance? What's worth measuring and how? What are some common pain points?

Let's find out!

Csaba is a contract full-stack developer currently helping HomeAway.com in building their landing pages.

=importxml("http://maps.googleapis.com/maps/api/directions/xml?origin=" &amp; A1 &amp; "&amp;destination=" &amp; A2 &amp; "&amp;sensor=false&amp;alternatives=false","//leg/distance/value")/1000

@csabapalfi
csabapalfi / caches-all-the-way-down.md
Last active May 30, 2019 07:41
Caches All the Way Down

Caches all the way down

https://ldnwebperf.org/events/caches-all-the-way-down/

Layers of caching in the browser

(kind of Chromium specific here and there)

1. MemoryCache

  • rendering process specific, short-lived
  • strict matching, same resource type, etc, CSP
  • everything (even no-cache, except for no-store)
@csabapalfi
csabapalfi / domains.sh
Created May 10, 2017 17:11
get top 10 domains requested from HAR files
# I used this to have a feel of which domains to prefetch DNS for on a quite heavy page
# top 10 domains in order
cat landingpage.har | jq '.log.entries[].request.url' | sed -e 's|"https\?://||' -e 's|/.*||' | awk '!x[$0]++' | head -10
# top 10 domains by frequency
cat landingpage.har | jq '.log.entries[].request.url' | sed -e 's|"https\?://||' -e 's|/.*||' | sort | uniq -c | sort -rn | head -10