Skip to content

Instantly share code, notes, and snippets.

View mbj's full-sized avatar

Markus Schirp mbj

View GitHub Profile
@mbj
mbj / config
Created January 13, 2012 12:35
systemctl status check
radon# cat /etc/systemd/system/mongodb.service
[Unit]
Description=MongoDB Server
Wants=network.target
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/mongod --config /etc/mongodb.conf
User=mongodb
@mbj
mbj / logical_implication.sql
Created October 15, 2020 15:10
Postgresql logical implication operator
CREATE FUNCTION
logical_implication(a boolean, b boolean)
RETURNS
boolean
LANGUAGE
sql
IMMUTABLE
PARALLEL SAFE
RETURNS NULL ON NULL INPUT
COST 1
@mbj
mbj / gist:8925037
Created February 10, 2014 21:56
cloudflare trace
fl=20f5
h=cloudflare.com
ip=93.193.206.191
ts=1392069350.665
visit_scheme=http
uag=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36
colo=AMS
spdy=off
0
@mbj
mbj / literal.rb
Created March 26, 2021 02:09
json to ruby literal
require 'json'
require 'unparser'
include Unparser::NodeHelpers
def mk_hash(hash)
s(:hash, *mk_pairs(hash))
end
def mk_pairs(hash)
@mbj
mbj / errors.txt
Last active May 21, 2019 22:27
Stripe OpenAPI validator errors
Exception in thread "main" org.openapitools.codegen.SpecValidationException: There were issues with the specification. The option can be disabled via validateSpec (Maven/Gradle) or --skip-validate-spec (CLI).
| Error count: 492, Warning count: 0
Errors:
-attribute paths.'/v1/orders'(post).requestBody.content.encoding.contentType is missing
-attribute paths.'/v1/reporting/report_types'(get).requestBody.content.schema.additionalProperties is not of type `object`
-attribute paths.'/v1/application_fees/{id}/refunds'(get).requestBody.content.schema.additionalProperties is not of type `object`
-attribute paths.'/v1/customers/{customer}/customer_balance_transactions/{transaction}'(get).requestBody.content.schema.additionalProperties is not of type `object`
-attribute paths.'/v1/tokens'(post).requestBody.content.schema.additionalProperties is not of type `object`
-attribute paths.'/v1/invoices'(post).requestBody.content.schema.additionalProperties is not of type `object`
-attribute paths.'/v1/account/capabil
@mbj
mbj / repro.rb
Last active May 6, 2019 01:50
Ruby weirdness
# jruby 1.7.4 (1.9.3p392) 2013-05-16 2390d3b on OpenJDK 64-Bit Server VM 1.7.0_40-b20 +indy [linux-amd64]
class Foo
define_method(:initialize) do
end
end
p Foo.public_instance_methods.include?(:initialize) # mri false, jruby true, rbx19 false
p Foo.protected_instance_methods.include?(:initialize) # mri false, jruby false, rbx19 false
@mbj
mbj / crash.rb
Last active December 5, 2018 19:38
Crash Ruby 2.5.3
system('uname -a')
# not relevant just to make sure we terminate early
# core dumping is expensive.
Thread.abort_on_exception = true
MUTEX = Mutex.new
# You may have to up this on your platform
50.times do
@mbj
mbj / segfault.rb
Last active September 28, 2017 17:50
segfault.rb
class Foo
include Enumerable
def each(&block)
[].__send__(:each, &block)
rescue Exception
end
def more
to_a # any method from enumerable
@mbj
mbj / report.txt
Created March 21, 2016 23:30
First mutant self pass
$ bundle exec mutant --include lib --require mutant --zombie --use rspec -- 'Mutant*'
Matcher: #<Zombie::Mutant::Matcher::Config match_expressions: [Mutant*]>
Integration: Zombie::Mutant::Integration::Rspec
Expect Coverage: 100.00%
Jobs: 8
Includes: ["lib"]
Requires: ["mutant"]
Subjects: 469
Mutations: 14827
Results: 14827
@mbj
mbj / gist:852757dc1d52aee9034f
Created March 19, 2016 02:32
Rubygems user assisted downgrade attack
Could not load OpenSSL.
You must recompile Ruby with OpenSSL support or change the sources in your Gemfile from 'https' to 'http'. Instructions for
compiling with OpenSSL using RVM are available at http://rvm.io/packages/openssl.