Skip to content

Instantly share code, notes, and snippets.

@mwolson
mwolson / index.css
Created Mar 20, 2019
zoom image into a box preserving aspect ratio
View index.css
.tc-ConversationItem[class] .tc-ConversationItem__avatar .tc-AvatarImage {
// modify these with something like calc(200%), or manual width/height "box" around the image
// which then gets zoomed to fit
width: 52px;
height: 52px;
}
.tc-AvatarImage[class].tc-AvatarImage--size--fit {
display: block;
width: 100%;
View pyramid.md

Test pyramid

We want more of the (faster and/or easier to write) things at the bottom of the pyramid, and less of the (slower and/or harder to write) things at the top of the pyramid.

                        /\
                       /  \
                      /    \
                     / security analysis
@mwolson
mwolson / updating-man-database.md
Created Oct 21, 2016
Updating man database (for man -k) on OS X
View updating-man-database.md

After installing new packages, the M-x man command might not list the new manpages for those packages, because the whatis DB used by man gets updated weekly via a cron job. Further, any manpages for programs that are part of the XCode Commandline Tools will never get installed because the cron job inexplicably excludes them. To make force them to be generated, run the following:

sudo /etc/periodic/weekly/320.whatis
sudo /usr/libexec/makewhatis /Applications/Xcode.app/Contents/Developer/usr/share/man
View memory leak fun
# Before
$ wrk -c 20 -t 6 -d 50s http://localhost:8181/health/healthcheck
Running 50s test @ http://localhost:8181/health/healthcheck
6 threads and 20 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 73.58ms 112.85ms 375.41ms 87.91%
Req/Sec 138.11 97.30 348.00 66.52%
41179 requests in 50.00s, 10.76MB read
Requests/sec: 823.57
Transfer/sec: 220.37KB
@mwolson
mwolson / local-node.sh
Created Mar 14, 2014
Run local compiled version of node.js in a shell, or execute some code with it
View local-node.sh
#!/bin/bash
export NODE_EXEC=/proj/helpers/node/node
export V8_PATH=/proj/helpers/node/deps/v8/out/native
if test -z "$1"; then
export PATH=/proj/helpers/node:"$PATH"
echo "Now using node $(which node); Ctrl+D to exit"
$SHELL
else
@mwolson
mwolson / swank-js-init.el
Last active Dec 15, 2015
Attaching to a swank-js node.js server using SLIME and Emacs
View swank-js-init.el
;; Improved Javascript support
(add-to-list 'load-path (concat my-emacs-path "/elisp/js2-mode"))
(autoload 'js2-mode "js2-mode" nil t)
(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))
;; Node REPL using SLIME
(add-to-list 'load-path (concat my-emacs-path "/elisp/slime"))
(add-to-list 'load-path (concat my-emacs-path "/elisp/slime/contrib"))
(require 'slime)
(autoload 'slime-js-minor-mode "slime-js" nil t)
@mwolson
mwolson / erc-solarized.el
Created Dec 4, 2012
Make ERC look nice with some themes
View erc-solarized.el
;;; Assumptions:
;;
;; - Solarized (dark) theme has already been loaded
;; https://github.com/sellout/emacs-color-theme-solarized
;;
;; - Nicks in ERC buffer before running this code may look weird.
;; New activity in ERC buffer after running this code should look OK.
(defun mwolson/make-erc-themeable ()
(interactive)