Skip to content

Instantly share code, notes, and snippets.

Avatar
🦄
Why does GitHub need statuses?

Alice wheresalice

🦄
Why does GitHub need statuses?
View GitHub Profile
@wheresalice
wheresalice / rest_proxy.yaml
Last active Apr 14, 2022
Swagger OpenAPI spec for Confluent REST Proxy
View rest_proxy.yaml
openapi: 3.0.1
info:
title: REST Proxy API
description: >-
The Confluent REST Proxy provides a RESTful interface to a Kafka cluster, making it easy to produce and consume messages, view the state of the cluster, and perform administrative actions without using the native Kafka protocol or clients.
<p>Some example use cases are</p>
<ul>
<li>Reporting data to Kafka from any frontend app built in any language not supported by official Confluent clients</li>
<li>Ingesting messages into a stream processing framework that doesn’t yet support Kafka</li>
<li>Scripting administrative actions</li>
View settings.yml
general:
debug : False # Debug mode, only for development
instance_name : "searx" # displayed name
contact_url: False # mailto:contact@example.com
enable_stats: False # activate /stats page - note: it may leak usage data
brand:
git_url: https://github.com/searx/searx
git_branch: master
issue_url: https://github.com/searx/searx/issues
@wheresalice
wheresalice / redisdns.py
Created Nov 27, 2011
Python DNS server with Redis backend
View redisdns.py
# A naive dns server with a Redis backend
# Set keys in Redis you want to be authoritative for (set google.com. 127.0.0.1)
# Tip: Use Redis's ttl functions to have temporary names
# Currently only does A records, feel free to fix that
#
# Licensed under the PSF License
# Thanks to: http://code.activestate.com/recipes/491264-mini-fake-dns-server/
# Author: @Kaerast <alice@kaerast.info>
import socket
@wheresalice
wheresalice / gist:3780828
Created Sep 25, 2012
Show largest tables in MySQL and Postgresql
View gist:3780828
# MySQL
SELECT CONCAT(table_schema, '.', table_name),
CONCAT(ROUND(table_rows / 1000000, 2), 'M') rows,
CONCAT(ROUND(data_length / ( 1024 * 1024 * 1024 ), 2), 'G') DATA,
CONCAT(ROUND(index_length / ( 1024 * 1024 * 1024 ), 2), 'G') idx,
CONCAT(ROUND(( data_length + index_length ) / ( 1024 * 1024 * 1024 ), 2), 'G') total_size,
ROUND(index_length / data_length, 2) idxfrac
FROM information_schema.TABLES
ORDER BY data_length + index_length DESC
LIMIT 10;
@wheresalice
wheresalice / openapi.yaml
Created Jun 10, 2019
OpenAPI spec for Confluent Schema Registry
View openapi.yaml
openapi: 3.0.1
info:
title: Schema Registry
version: 5.2.1
description: Schema Registry provides a serving layer for your metadata. It provides a RESTful interface for storing and retrieving Avro schemas. It stores a versioned history of all schemas, provides multiple compatibility settings and allows evolution of schemas according to the configured compatibility settings and expanded Avro support. It provides serializers that plug into Apache Kafka® clients that handle schema storage and retrieval for Kafka messages that are sent in the Avro format.
externalDocs:
url: >-
https://docs.confluent.io/current/schema-registry/develop/api.html#schemaregistry-api
description: Confluent's API reference
paths:
@wheresalice
wheresalice / .htaccess
Created Feb 25, 2011
webfont .htaccess rules
View .htaccess
# ----------------------------------------------------------------------
# Webfont access
# ----------------------------------------------------------------------
# allow access from all domains for webfonts
# alternatively you could only whitelist
# your subdomains like "sub.domain.com"
<FilesMatch "\.(ttf|otf|eot|woff|font.css)$">
<IfModule mod_headers.c>
View jenkins_last_good_commit.rb
require 'net/http'
require 'json'
# We could just use localhost, but it's nice to print usable urls in debug
@jenkins = `hostname`.strip
# Get the list of jobs on the Jenkins instance
res = Net::HTTP.get_response(URI('http://'+@jenkins+'/api/json'))
jobs = JSON.parse(res.body)['jobs']
View docker-compose.yml
version: '2'
services:
zookeeper:
image: "confluentinc/cp-zookeeper:5.4.0"
hostname: zookeeper
ports:
- '32181:32181'
environment:
ZOOKEEPER_CLIENT_PORT: 32181
ZOOKEEPER_TICK_TIME: 2000
View gist:c347e6b909d0bbc4256bb891e74c3191
#!/bin/bash -xe
# Parse server.properties to get Zookeeper hosts
ZK_HOST=$(grep 'zookeeper.connect=' /etc/kafka/server.properties | cut -d'=' -f 2)
# Find the most newly created directory of Kafka in the /opt directory
KAFKA_PATH=$(find /opt/ -maxdepth 1 -name kafka-2* -print0 | xargs -0 ls -d -1 -t | head -n1)
# Manually configured list of brokers to rebalance across (zero-indexed)
BROKER_LIST="0,1,2"
@wheresalice
wheresalice / ezclone.sh
Last active Jun 12, 2020
A shell function for cloning a git repository into a sensible place. `ezclone <repo url>` or `ezclone golang <repo url>`
View ezclone.sh
function ezclone() {
# assumes cloning from a git@ url...
# clone to git_src by default
repo_base=~/git_src
if [[ "$1" == "golang" ]]; then
repo_base=~/go/src
shift
fi