Skip to content

Instantly share code, notes, and snippets.

Disclaimer: I'm not the original author of this sheet, but can't recall where I found it. If you know the author, please let me know so I give the attribution.

Note: Since this seems to be helpful to some people, I formatted it to improve readability of the original. Also, note that this is from 2016, many things may have changed, and I don't use macOS anymore, so I probably can't help in case of questions, but maybe someone else can.

Mac Network Commands Cheat Sheet

After writing up the presentation for MacSysAdmin in Sweden, I decided to go ahead and throw these into a quick cheat sheet for anyone who’d like to have them all in one place. Good luck out there, and stay salty.

Get an ip address for en0:

@kgrz
kgrz / main.css
Created September 13, 2013 14:37
/* A modified default Jekyll theme
/*
/* Improvements include:
/*
/* 1. Responsive Template: Added media-queries so that it works well
/* on a wide-range of screens.
/*
The MIT License (MIT)
@kgrz
kgrz / nginx.conf
Created January 26, 2021 11:57 — 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
@kgrz
kgrz / vimgrep.md
Created October 5, 2020 10:54 — forked from seanh/vimgrep.md
vimgrep cheatsheet

vimgrep

  • Vimcasts on vimgrep

  • Uses native vim regexes (which are slightly different from the regexes used by grep, ack, ag, etc) so the patterns are the same as with vim's within-file search patterns.

You can do a normal within-file search first, then re-use the same pattern to

@kgrz
kgrz / feature-flags.md
Created August 10, 2020 01:33 — forked from threepointone/feature-flags.md
Feature flags: why, how, all that

(I'm enjoying doing these raw, barely edited writeups; I hope they're useful to you too)

Feature flags

This is my own writeup on feature flags; for a deep dive I'd recommend something like Martin Fowler's article (https://martinfowler.com/articles/feature-toggles.html).

So. Feature flags. The basic idea that you'll store configuration/values on a database/service somewhere, and by changing those values, you can change the user experience/features for a user on the fly.

Let's say that you're building a new feature, called 'new-button' which changes the color of buttons, which is currently red, to blue. Then you'd change code that looks like this -

@kgrz
kgrz / gist:2880883
Created June 6, 2012 09:24 — forked from kaiwren/gist:1283905
Steve Yegge's SOA post

From: https://raw.github.com/gist/933cc4f7df97d553ed89/24386c6a79bb4b31fb818b70b34c5eab7f12e1ff/gistfile1.txt

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

@kgrz
kgrz / ToggleHDRCatalina.applescript
Created July 15, 2020 04:39 — forked from lexrus/ToggleHDRCatalina.applescript
Workaround the HDR bug of macOS Catalina 10.15.4
tell application "System Preferences"
activate
end tell
tell application "System Events"
tell process "System Preferences"
activate
delay 1
click menu item "Displays" of menu "View" of menu bar 1
delay 1

Mistakes to Avoid: Docker Antipatterns

Whichever route you take to implementing containers, you’ll want to steer clear of common pitfalls that can undermine the efficiency of your Docker stack.

Don’t run too many processes inside a single container

The beauty of containers—and an advantage of containers over virtual machines—is that it is easy to make multiple containers interact with one another in order to compose a complete application. There is no need to run a full application inside a single container. Instead, break your application down as much as possible into discrete services, and distribute services across multiple containers. This maximizes flexibility and reliability.

Don’t install operating systems inside Docker containers

It is possible to install a complete Linux operating system inside a container. In most cases, however, this is not necessary. If your goal is to host just a single application or part of an application in the container, you need to install only the essential

@kgrz
kgrz / app.rb
Last active November 13, 2019 22:02
Sample working code for http://stackoverflow.com/questions/36354581/how-to-use-rails-autoprefixer-in-sinatra-app. Refer to the file folder_structure.txt for reference
require 'sinatra'
require 'sprockets'
require 'autoprefixer-rails'
assets = Sprockets::Environment.new do |env|
# append assets paths
env.append_path "assets"
end
AutoprefixerRails.install(assets)