"I have a trick that makes things easier for me. Since writing is very hard and rewriting is comparatively easy and rather fun, I always write my scripts all the way through as fast as I can, the first day, if possible, putting in crap jokes and pattern dialogue—“Homer, I don’t want you to do that.” “Then I won’t do it.” Then the next day, when I get up, the script’s been written. It’s lousy, but it’s a script. The hard part is done. It’s like a crappy little elf has snuck into my office and badly done all my work for me, and then left with a tip of his crappy hat. All I have to do from that point on is fix it. So I’ve taken a very hard job, writing, and turned it into an easy one, rewriting, overnight. I advise all writers to do their scripts and other writing this way. And be sure to send me a small royalty every time you do it." - John Swartzwelder
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
; Modified drivetrain.ini file for Assetto Corsa Alfa Romeo 33 Stradale | |
; (ks_alfa_33_stradale). Recommend you use the app Assetto Corsa Car Tuner to | |
; make a tuned clone of the base car, then copy/paste over the drivetrain.ini | |
; file in the cloned version. | |
[HEADER] | |
VERSION=3 | |
[TRACTION] | |
TYPE=RWD ; Wheel drive. Possible options: FWD (Front Wheel Drive), RWD (Rear Wheel Drive) |
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
[HEADER] | |
VERSION=3 | |
[TRACTION] | |
TYPE=RWD ; Wheel drive. Possible options: FWD (Front Wheel Drive), RWD (Rear Wheel Drive) | |
[GEARS] | |
COUNT=6 ; forward gears number | |
GEAR_R=-3.273 ; rear gear ratio | |
; forward gears ratios. must be equal to number of gears defined on count |
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
module ShellScriptUtils | |
class CursedReport | |
def initialize(message = nil) | |
@clear_commands = [] | |
@message = message | |
update @message | |
end | |
def update(message) | |
clear @message # clear the current message |
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
A12345 Jon Osterman | |
A23456 Walter Kovacs | |
A34567 Daniel Dreiberg | |
987 Dr. Manhattan | |
876 Rorshach | |
765 Night Owl | |
A12345 987 | |
A23456 876 |
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 ruby | |
require 'logger' | |
require 'open3' | |
require 'optparse' | |
require 'ostruct' | |
require 'thread' | |
class ShellScript |
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
# Excerpt from ptools gem | |
# Returns whether or not +file+ is a binary non-image file, i.e. executable, | |
# shared object, ect. Note that this is NOT guaranteed to be 100% accurate. | |
# It performs a "best guess" based on a simple test of the first | |
# +File.blksize+ characters, or 4096, whichever is smaller. | |
# | |
# By default it will check to see if more than 30 percent of the characters | |
# are non-text characters. If so, the method returns true. You can configure | |
# this percentage by passing your own as a second argument. |
Ebike batteries have a handful of important ratings that you should check before purchasing any battery. The main two (V and Ah) are commonly listed, but there are some other important measurements that may be more difficult to find:
- Voltage (V): It's useful to think of voltage as pressure in a system. Higher voltage = higher pressure. The voltage of the pack must match your controller and display. Motors are generally pretty flexible in what they can accept. Voltage limits are strict; that is to say, you cannot exceed them. The important caveat there is, of course, motors. A motor's voltage rating isn't actually a max voltage rating, it's a suggestion based on the motor's max amperage and power rating. Why this is the case will become clear later.
- Amps (A): Think of amperage (amps) as the volume of flow in a system. More amps = greater flow. All of the electrical components on your ebike will have amperage ratings expressed as max and continuous. The max number is a "never exceed" number, while
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
# Server is defined in stage file deploy/staging.rb | |
# server 'staging.example.com', user: 'staginguser', roles: %i(app db web) | |
# Expect `say_hello` task to output: | |
# echo 'hello from "staginguser"' | |
# What `say_hello` task actually outputs: | |
# echo 'hello from nil' | |
task :say_hello do | |
on roles(:app) do | |
execute "echo 'hello from #{fetch(:user).inspect}'" |
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 ruby | |
# This script establishes a UNIX server socket. | |
# | |
# Expected result: Script should run and immediately exit. | |
# | |
# Actual result: Script fails with Errno::EADDRINUSE error. | |
# | |
# Environment: Windows 10 Pro, WSL, Ubuntu 18.04.2, ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux-gnu] | |
# |
NewerOlder