- Whenever you connect online, it redistributes your resources between offline and online.
- Generally, a small amount will remain offline and all the rest will go online.
- If you spend stuff for online stuff, it comes out of your online resources.
- If you spend stuff for regular (offline) stuff, it typically comes out of your offline resources.
- This can leave you deeply in the negative if you're ever offline.
- Being negative is very bad and can lead to staff leaving.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% ruby -rbcrypt -e '(1..100).each { |len| abort "max len is #{len}" if BCrypt::Password.create("a" * len) == "a" * (len+1) }' | |
max len is 72 | |
zsh: exit 1 ruby -rbcrypt -e | |
ruby -rbcrypt -e 9.12s user 0.06s system 99% cpu 9.192 total | |
% ruby -rbcrypt -rpp -e 'pp (1..100).map { |len| goodpass = "a" * len; badpass = "a" * (len+1); pass = BCrypt::Password.create(goodpass); [len, pass == goodpass, pass == badpass] }' | |
[[1, true, false], | |
[2, true, false], | |
[3, true, false], | |
[4, true, false], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task(default: [:link_hooks, :test]) | |
task :link_hooks do | |
sh 'ln', '-nsf', '../../hooks/pre-commit', '.git/hooks/pre-commit' | |
end | |
task :pre_commit do | |
require 'open3' | |
Dir.mktmpdir do |tmpdir| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
exec 1>&2 | |
MIX_ENV=test exec mix git.test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Benchmark do | |
defmacro __using__(_) do | |
quote do | |
import Benchmark | |
def measure(name, function) do | |
{usecs, retval} = function |> :timer.tc | |
IO.puts("#{name} took #{usecs} µs") | |
retval | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule StrNext do | |
@character_ranges [ | |
{'A', 'Z'}, | |
{'a', 'z'}, | |
{'0', '9'} | |
] | |
@characters Enum.map(@character_ranges, fn {a, z} -> | |
hd(a)..hd(z) | |
|> Enum.to_list() | |
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
wget -nc -r --accept-regex='https://www.rockpapershotgun.com/2018/12/[0-9]+/the-rps-advent-calendar-2018-dec-[^/]+/$|https://www.rockpapershotgun.com/tag/the-rps-advent-calendar-2018/page/[0-9]+/$' https://www.rockpapershotgun.com/tag/the-rps-advent-calendar-2018/ | |
echo | |
echo "====================================" | |
find www.rockpapershotgun.com/2018 -name 'index.html' -print0 | sort -z | xargs -0 grep "</a>!</p>" | cut -d/ -f2-4,8- | sed "s#/www#>#g" | cut -d'>' -f1,3 | cut -d'<' -f1 | sed -e "s/>/: /" -e "s#/#-#g" -e "s/’/'/g" | |
echo "====================================" | |
echo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env elixir | |
defmodule Fixer do | |
def parse_args(["-n" | args]), do: {false, args} | |
def parse_args(["-f" | args]), do: {true, args} | |
def parse_args(args), do: {false, args} | |
def fix_all({rename, files}) do | |
{:ok, stdout} = File.open("/dev/stdout", [:write]) | |
Process.register(stdout, :stdout_binary) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on run argv | |
if (count of argv) = 1 then | |
set p to (item 1 of argv) as text | |
else | |
log "(development mode)" | |
set p to "/tmp/test.png" | |
end if | |
# Reveal the file in Finder. | |
# If QuickLook is already open, this will change it to the new file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Record current app so we can switch back to it after. | |
tell application "System Events" | |
set frontmostApplicationName to name of 1st process whose frontmost is true | |
end tell | |
-- Switch to Discord and hit cmd-shift-M. | |
-- This is a built-in keybind and does not require any setup. | |
tell application "Discord" to activate | |
tell application "System Events" | |
keystroke "m" using {command down, shift down} |