Skip to content

Instantly share code, notes, and snippets.

View SuperQ's full-sized avatar

Ben Kochie SuperQ

View GitHub Profile
@squeed
squeed / numcpu_override.c
Last active November 7, 2023 09:34
How to override _SC_NPROCESSORS_CONF when you know what you're doing.
// SPDX-License-Identifier: Apache-2.0
//
// Override sysconf CPU count detection. Why? Because cgroups exist. A process
// running on a 256-core machine, but with 2 cores of CPU granted, should not start
// 256 worker threads. I'm looking at you, gRPC.
//
// If you wanted, you could parse the cgroup knobs automatically.
//
// compile with
// gcc -shared -fPIC -Wall -Wextra -Werror numcpu_override.c -o numcpu_override.so -ldl
#!/usr/bin/env ruby
# use snmptranslate to lookup OID if there's no comment after an existing numeric OID
def translate_oid(oid)
@cache ||= {}
@cache[oid] ||= `snmptranslate -Os -mALL #{oid}`
end
file = 'generator.yml.j2'
@matthiasr
matthiasr / LICENSE.md
Last active February 15, 2023 00:16
Exporting chef-client metrics to Prometheus

The MIT License (MIT)

Copyright © 2017 SoundCloud Ltd.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE

@gene1wood
gene1wood / batch-delete-gmail-emails.js
Last active May 20, 2024 00:41
A Google Apps Script script to bulk delete large amounts of email in Gmail while avoiding the error #793 which Gmail encounters normally
/*
This script, when used with Google Apps Scripts, will delete 400 emails and
can be triggered to run every few minutes without user interaction enabling you
to bulk delete email in Gmail without getting the #793 error from Gmail.
Google returns a maximum of 500 email threads in a single API call.
This script fetches 400 threads in case 500 threads is causing timeouts
Configure the search query in the code below to match the type of emails
you want to delete