Skip to content

Instantly share code, notes, and snippets.

View durandom's full-sized avatar
😶
my dog's got no nose

Marcel Hild durandom

😶
my dog's got no nose
View GitHub Profile
@durandom
durandom / iracing-sample.json
Created November 28, 2022 19:59
iracing sample CrewChief
{"time":1669661619395,"telemetry":{"Clutch":1.0,"Brake":0.0,"Throttle":0.9991061,"Handbrake":0.0,"SteeringAngle":0.0944157839,"Rpms":0.0,"Gear":0,"SpeedMs":50.70474,"DistanceRoundTrack":4283.12158,"CurrentLap":1,"CurrentLapTime":110.148262}}
{"time":1669661619426,"telemetry":{"Clutch":1.0,"Brake":0.0,"Throttle":0.9991061,"Handbrake":0.0,"SteeringAngle":0.0944157839,"Rpms":0.0,"Gear":4,"SpeedMs":50.7033844,"DistanceRoundTrack":4284.81055,"CurrentLap":1,"CurrentLapTime":110.181595}}
{"time":1669661619457,"telemetry":{"Clutch":1.0,"Brake":0.0,"Throttle":0.9991061,"Handbrake":0.0,"SteeringAngle":0.09211275,"Rpms":0.0,"Gear":4,"SpeedMs":50.7513466,"DistanceRoundTrack":4285.65527,"CurrentLap":1,"CurrentLapTime":110.198265}}
{"time":1669661619487,"telemetry":{"Clutch":1.0,"Brake":0.0,"Throttle":0.9991061,"Handbrake":0.0,"SteeringAngle":0.08664401,"Rpms":0.0,"Gear":4,"SpeedMs":50.8654671,"DistanceRoundTrack":4287.34766,"CurrentLap":1,"CurrentLapTime":110.2316}}
{"time":1669661619518,"telemetry":{"Clutch":1.0,"Brake":
@durandom
durandom / hive_schema.py
Created June 26, 2020 09:14
infer hive schema from parquet file
def hive_schema(filename):
nl = ',\n'
diag_parq = fastparquet.ParquetFile(filename)
data = diag_parq.schema.text
schema = filter(None, data.split('\n')[1:])
schema = [re.sub(r'^[^a-z]+', ' ', l) for l in schema]
schema = [re.sub(r':', '', l) for l in schema]
schema = [re.sub(r'BYTE_ARRAY.*', 'STRING', l) for l in schema]
schema = [re.sub(r'INT64, TIMESTAMP_MICROS.*', 'TIMESTAMP', l) for l in schema]
schema = [re.sub(r'INT64, TIMESTAMP_MILLIS.*', 'TIMESTAMP', l) for l in schema]
@durandom
durandom / widen.js
Last active September 27, 2017 13:09
Gitter - Wider rooms
// Extend width of left bar from 34rem to 40rem
// For the desktop app:
// * enable developer tools
// * right click anywhere -> inspect element, to bring up the console
// * copy and paste
$('.desktop .room-menu__panel').setAttribute('style', 'width: 40rem');
$('.app-layout.app-layout--left-menu').setAttribute('style', 'width: calc(100% - (40rem))');
@durandom
durandom / extract_ovirt.sh
Created May 9, 2017 18:29
extract a provider
#!/usr/bin/env bash
~/src/scratch/manageiq/extract_provider_gem.sh \
-n ovirt \
-d "app/models/manageiq/providers/redhat spec/models/manageiq/providers/redhat spec/vcr_cassettes/manageiq/providers/redhat" \
-l \
-e ~/src/manageiq \
-r \
-g ~/src/manageiq \
-p durandom \
@durandom
durandom / Gemfile.rb
Last active May 4, 2017 07:36
bundle evaluating Gemfile twice
#
# Custom Gemfile modifications
#
# To develop a gem locally and override its source to a checked out repo
# you can use this helper method in Gemfile.dev.rb e.g.
#
# override_gem 'manageiq-ui-classic', :path => File.expand_path("../manageiq-ui-classic", __dir__)
#
puts :hmm
def override_gem(name, *args)
@durandom
durandom / rspec
Created March 13, 2017 20:07
webmock
❯ be spring rspec ./spec/models/manageiq/providers/amazon/regions_spec.rb:2
** master - DB vmdb_test on localhost
Running via Spring preloader in process 38083
/Users/hild/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-mocks-3.5.0/lib/rspec/mocks/space.rb:51:in `raise_lifecycle_message': The use of doubles or partial doubles from rspec-mocks outside of the per-test lifecycle is not supported. (RSpec::Mocks::OutsideOfExampleError)
from /Users/hild/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-mocks-3.5.0/lib/rspec/mocks/space.rb:11:in `proxy_for'
from /Users/hild/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-mocks-3.5.0/lib/rspec/mocks/matchers/receive.rb:85:in `setup_mock_proxy_method_substitute'
from /Users/hild/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-mocks-3.5.0/lib/rspec/mocks/matchers/receive.rb:43:in `setup_allowance'
from /Users/hild/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rspec-mocks-3.5.0/lib/rspec/mocks/targets.rb:46:in `define_m
1) ManageIQ::Providers::Azure::CloudManager::Refresher will perform a full refresh
Failure/Error: expect(actual).to eq expected_table_counts
expected: {:ext_management_system=>2, :flavor=>63, :availability_zone=>1, :vm_or_template=>12, :vm=>11, :miq_te...p=>10, :network_port=>11, :cloud_network=>6, :floating_ip=>13, :network_router=>0, :cloud_subnet=>6}
got: {:ext_management_system=>2, :flavor=>80, :availability_zone=>1, :vm_or_template=>12, :vm=>11, :miq_te...p=>11, :network_port=>11, :cloud_network=>6, :floating_ip=>13, :network_router=>0, :cloud_subnet=>6}
(compared using ==)
Diff:
@@ -3,7 +3,7 @@
@durandom
durandom / service_object.rb
Last active November 29, 2016 18:39
Service Objects MIQ
# current implementation Amazon
def raw_stop
with_provider_object(&:stop)
# Temporarily update state for quick UI response until refresh comes along
self.update_attributes!(:raw_power_state => "shutting_down")
end
# implementation with Service Object
# base class for api docs
@durandom
durandom / pre-commit.rb
Created July 7, 2016 12:52
git pre-commit hook that runs rubocop on staged files
#!/usr/bin/env ruby
# make sure you have gem 'rubocop-git' in your Gemfile
require 'readline'
def input(prompt="", newline=false)
prompt += "\n" if newline
Readline.readline(prompt, true).squeeze(" ").strip
end
@durandom
durandom / General.txt
Last active July 7, 2016 08:19
Intellj Samples
IntelliJ IDEA is a full-featured IDE
with a high level of usability and outstanding
advanced code editing and refactoring support.
abcdefghijklmnopqrstuvwxyz 0123456789 (){}[]
ABCDEFGHIJKLMNOPQRSTUVWXYZ +-*/= .,;:!? #&$%@|^