Skip to content

Instantly share code, notes, and snippets.

@prantlf
prantlf / Mac OSX Setup - Brew
Created November 15, 2018 18:02 — forked from jbelke/Mac OSX Setup - Brew
Mac OSX Setup - Brew and Cask
# Get Sudo.
if [ $EUID != 0 ]; then
sudo "$0" "$@"
exit $?
fi
# Install Xcode first - https://itunes.apple.com/us/app/xcode/id497799835?ls=1&mt=12
# Install Xcode command line tools.
xcode-select --install
@prantlf
prantlf / install_ruby_with_rbenv.md
Last active December 3, 2018 16:23 — forked from stonehippo/install_ruby_with_rbenv.md
Installing a new Ruby with rbenv on Mac OS

Install a new Ruby with rbenv on Mac OS (and make yourself a superhero)

If you're doing stuff with Ruby on a Mac, e.g. installling Jekyll or something, by default you'll end up having to use the sudo command to do stuff, since the permission to modify the default config is not available to your user account.

This sucks and should be avoided. Here's how to fix that.

Installing a new Ruby

To make this better, we are going install a new, custom Ruby. This used to be a big, scary thing, but thanks to the awesome tools Homebrew and rbenv, it's a snap.*

A word of warning: you will have to use Terminal to install this stuff. If you are uncomfortable with text, words, and doing stuff with your computer beyond pointing and hoping, this may not work well for you. But if that's the case, I'm not sure why you were trying to use Ruby in the first place.

@prantlf
prantlf / color-conversion-algorithms.js
Created February 25, 2019 01:12 — forked from mjackson/color-conversion-algorithms.js
RGB, HSV, and HSL color conversion algorithms in JavaScript
/**
* Converts an RGB color value to HSL. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
* Assumes r, g, and b are contained in the set [0, 255] and
* returns h, s, and l in the set [0, 1].
*
* @param Number r The red color value
* @param Number g The green color value
* @param Number b The blue color value
* @return Array The HSL representation
@prantlf
prantlf / nginx.conf
Last active September 29, 2019 12:15 — forked from foxxyz/nginx.conf
Serve current directory via nginx
# Simple development setup to serve a directory at http://localhost:9001.
# Start nginx in the directory to serve with `nginx -c ~/nginx.conf`.
# When using a laptop with an above average equipment. 2 workers
# significantly increase the throughput. 4 workers still help
# noticeably. The server slows down With more than 6 workers.
worker_processes 2;
events {
accept_mutex off;
}
@prantlf
prantlf / har2paths.js
Last active September 29, 2019 10:06
Extract URL paths from a HAR file
// Useful for generating a list of paths for performance testing using `wrk`
// and https://github.com/timotta/wrk-scripts/blob/master/multiplepaths.lua.
const description = `Usage: node har2paths (file.har) > paths.txt
Prints URL paths of all server calls made while loading the first page
from the HAR file, which has been created for a SPA.`
const harName = process.argv[2]
if (!harName) {
@prantlf
prantlf / package.json
Last active October 1, 2019 08:46
Serves files from the current directory and subdirectories over HTTP for local development purposes using multiple workers.
{
"name": "dev-http-server",
"version": "0.0.1",
"description": "Development HTTP server serving the current duirectory.",
"license": "MIT",
"author": "Ferdinand Prantl <[email protected]> (http://prantl.tk/)",
"contributors": [],
"homepage": "https://gist.github.com/prantlf/2514e4b43b8c6ef6ab08a4d2084a69ba",
"repository": "https://gist.github.com/prantlf/2514e4b43b8c6ef6ab08a4d2084a69ba",
"bugs": "https://gist.github.com/prantlf/2514e4b43b8c6ef6ab08a4d2084a69ba",
@prantlf
prantlf / main_test.go
Last active March 3, 2023 17:47
Tests and benchmarks for formatting integers with commas separating thousands
// Save this file as main_test.go and run "go test -bench ."
package main
import (
"bytes"
"fmt"
"regexp"
"strconv"
"testing"
#!/usr/bin/env python3
#
# Copyright 2014-2020 Cameron Hart <[email protected]>.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
@prantlf
prantlf / kextsthatwillmakeanadmincry.py
Last active December 15, 2020 20:53 — forked from erikng/kextsthatwillmakeanadmincry.py
Prints kernel extensions on OSX
#!/usr/bin/python
# Credit to frogor for the objc
from Foundation import NSBundle
import json
import objc
import os
import plistlib
import subprocess
@prantlf
prantlf / diablo2_instructions.md
Created December 18, 2020 01:19 — forked from rodrigore/diablo2_instructions.md
Diablo2 on Mac OSX El Capitan

Diablo II LoD on Mac OSX El Capitan

These are the instructions for using Terminal to install the Windows version of the game onto your machine. You can then easily copy the game multiple times for different mods you might want to play.

In this guide you'll end up with: