Skip to content

Instantly share code, notes, and snippets.

# 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}'"
#!/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]
#
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Web application could not be started</title>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,400i,700" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Lato:300,400,700" rel="stylesheet">
<style type="text/css">/*!
* Bootstrap v3.3.7 (http://getbootstrap.com)
id gear
0 R
1 N
2 1st
3 2nd
4 3rd
5 4th
6 5th
7 6th
8 7th
@bradland
bradland / gs_data_updater.js
Created November 7, 2017 16:01
Updates data URL from named range.
function onOpen(e) {
SpreadsheetApp.getUi()
.createMenu('Data Mgmt')
.addItem('Refresh Pipeline Data', 'getData')
.addToUi();
}
function getData() {
// 'Data Import' sheet uses IMPORTDATA() function to pull CSV data from Pipeline application. This function
// only updates once an hour by default. This formula is used to alter the import URL so that the function
lap_time throttle mph rpm gear hg fg
172264 1.00 27.66 3139.65 2 -0.04 0.52
172280 1.00 27.86 3161.41 2 -0.04 0.57
172296 1.00 28.06 3177.08 2 -0.04 0.59
172316 1.00 28.32 3205.00 2 -0.03 0.60
172332 1.00 28.53 3229.73 2 -0.01 0.60
172348 1.00 28.74 3254.50 2 0.00 0.62
172364 1.00 28.95 3279.07 2 0.01 0.61
172384 1.00 29.23 3310.62 2 0.03 0.61
172396 1.00 29.39 3331.57 2 0.03 0.63
@bradland
bradland / ac-telemetry.rb
Last active May 13, 2020 03:46
Beginnings of a rudimentary CLI telemetry utility for Assetto Corsa written in Ruby.
#!/usr/bin/env ruby
$: << './lib'
require 'socket'
require 'bindata'
require 'json'
class UTF8String < BinData::String
def snapshot
@bradland
bradland / pingr
Last active December 13, 2018 22:04
#!/usr/bin/env ruby
require 'logger'
require 'open3'
require 'optparse'
require 'ostruct'
require 'thread'
class ShellScript
#!/bin/bash
# argument one is the input base file name
#ffmpeg -i $1.flv -vcodec png -vframes 1 -ss 00:00:$2 -an -f rawvideo -s 640x480 $1-640x480.png
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=15 > out.gif
require 'bindata'
# Record definition
class PCarsNet < BinData::Record
endian :little
uint16 :build_version_number # 0
uint8 :packet_type # 2
bit4 :session_state # 3
bit4 :game_state # 3