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
default: | |
# list of environment variables applied to all components | |
env: | |
- name: OTEL_SERVICE_NAME | |
valueFrom: | |
fieldRef: | |
apiVersion: v1 | |
fieldPath: "metadata.labels['app.kubernetes.io/component']" | |
- name: OTEL_K8S_NAMESPACE | |
valueFrom: |
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
# create a topic with specified partitons | |
kafka-topics --bootstrap-server xx.xx.xx.xx:39092 --create --partitions 2 --topic test-partitions | |
kafka-topics --bootstrap-server xx.xx.xx.xx:39092 --describe --topic test-partitions | |
# create a topic with default partitions | |
kafka-topics --bootstrap-server xx.xx.xx.xx:39092 --create --topic test-def-partitions | |
kafka-topics --bootstrap-server xx.xx.xx.xx:39092 --describe --topic test-def-partitions | |
# alter the number of partitions of an existing topic | |
kafka-topics --bootstrap-server xx.xx.xx.xx:39092 --alter --topic test-def-partitions --partitions 3 |
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
# Get the object path for a service with the "easy name" | |
sudo busctl --verbose --system call org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager GetUnit s snap.docker.dockerd.service | |
# get the ActiveState d-bus property of the Unit object | |
sudo busctl --verbose --system get-property org.freedesktop.systemd1 /org/freedesktop/systemd1/unit/snap_2edocker_2edockerd_2eservice org.freedesktop.systemd1.Unit ActiveState | |
# get the OOMScoreAdjust d-bus property of the Service object | |
sudo busctl --verbose --system get-property org.freedesktop.systemd1 /org/freedesktop/systemd1/unit/snap_2edocker_2edockerd_2eservice org.freedesktop.systemd1.Service OOMScoreAdjust |
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
// Please find the full, tested version in | |
// https://github.com/influxdata/influxdb_iox/blob/fe155e15fb2ad166aee66b0458e63c24a8128dd4/query/src/exec/task.rs#L101-L118 | |
pub struct DedicatedExecutor { | |
state: Arc<Mutex<State>>, | |
} | |
/// Runs futures (and any `tasks` that are `tokio::task::spawned` by | |
/// them) on a separate Tokio Executor | |
struct State { |
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
#!/bin/bash | |
# from https://github.com/cernceph/ceph-scripts/blob/master/tools/scrubbing/autorepair.sh | |
for PG in $(ceph pg ls inconsistent -f json | jq -r .pg_stats[].pgid) | |
do | |
echo Checking inconsistent PG $PG | |
if ceph pg ls repair | grep -wq ${PG} | |
then | |
echo PG $PG is already repairing, skipping | |
continue |
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
import os | |
import re | |
def zsh_to_fish(cmd): | |
return (cmd.replace('&&', '; and ') | |
.replace('||', '; or ')) | |
def is_valid_fish(cmd): |
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
use actix_service::{Service, Transform}; | |
use actix_web::{dev::ServiceRequest, dev::ServiceResponse, Error}; | |
use futures::future::{ok, FutureResult}; | |
use futures::{Future, Poll}; | |
use slog::info; | |
// There are two step in middleware processing. | |
// 1. Middleware initialization, middleware factory get called with | |
// next service in chain as parameter. | |
// 2. Middleware's call method get called with normal request. |
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 python | |
from __future__ import print_function | |
import boto3 | |
import base64 | |
client = boto3.client(service_name='ec2', region_name='us-east-1') | |
for region in client.describe_regions()['Regions']: | |
ec2 = boto3.resource(service_name='ec2', region_name=region['RegionName']) | |
for instance in ec2.instances.all(): | |
response = instance.describe_attribute(Attribute='userData') |
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
package main | |
import ( | |
"net/http" | |
) | |
func main() { | |
go func() { | |
http.ListenAndServe(":8001", &fooHandler{}) | |
}() |
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
ruby_block "create ssh key" do | |
block do | |
k = SSHKey.generate(:type => 'RSA', :bits => 1024, :comment => "Postgres Master") | |
node.set[:postgresql][:pubkey] = k.ssh_public_key | |
node.save | |
# Much of the DSL disappears in ruby blocks. Here's how to create a template. | |
rc = Chef::RunContext.new(node, node.cookbook_collection) | |
t = Chef::Resource::Template.new "/var/lib/postgresql/.ssh/id_rsa" | |
t.source("id_rsa.erb") |
NewerOlder