Skip to content

Instantly share code, notes, and snippets.

@JohannesRudolph
JohannesRudolph / lg.bin
Last active February 24, 2023 18:07
4k at 60Hz via HDMI 2.0 on a Coffee Lake integrated GPU using Fedora
@JohannesRudolph
JohannesRudolph / collie-cheatsheet.sh
Created June 30, 2022 09:33
collie cli cheatsheet - a list of useful tricks around collie
# query costs and output a filtered tsv, inspiration https://stackoverflow.com/a/39144364/125407
collie tenant cost --from 2022-05-01 --to 2022-05-31 meshcloud-dev --platform azure.meshcloud-azure-dev -o json \
| jq -r ".[] | [.relatedTenant.platformTenantId, .relatedTenant.platformTenantName, .totalUsageCost] | @tsv"
@JohannesRudolph
JohannesRudolph / dbconnect-mongodb.sh
Created June 26, 2018 16:46
connect to cloud foundry db services via cf ssh tunnels
#!/bin/bash
set -e
container="$1:dbssh"
VCAP_SERVICES=$(cf ssh $container -c 'echo $VCAP_SERVICES')
MONGO_URI=$(echo $VCAP_SERVICES | jq -r .MongoDB[0].credentials.uri)
PARSED_URI=$(./parse-url $MONGO_URI)
@JohannesRudolph
JohannesRudolph / cors.lua
Last active March 4, 2021 13:41
HAproxy Lua Script for answering CORS preflight requests (for OpenStack Swift)
core.register_service("cors-response", "http", function(applet)
applet:set_status(200)
applet:add_header("Content-Length", "0")
applet:add_header("Access-Control-Allow-Origin", applet.headers["origin"][0])
applet:add_header("Access-Control-Allow-Credentials", "true")
applet:add_header("Access-Control-Allow-Headers", "Origin, DNT, If-Match, If-Modified-Since, If-None-Match, If-Range, If-Unmodified-Since, X-Requested-With, Content-Type, X-Auth-Token, X-Service-Token, X-Newest, X-Trans-Id-Extra, X-Trans-Id, X-Account-Meta-Temp-URL-Key, X-Account-Meta-Temp-URL-Key-2, X-Timestamp, X-Openstack-Request-Id, X-Account-Bytes-Used, X-Account-Container-Count, X-Account-Object-Count, X-Account-Meta-Quota-Bytes, X-Account-Access-Control, X-Container-Meta-Temp-URL-Key, X-Container-Meta-Temp-URL-Key-2, X-Storage-Policy, X-Container-Object-Count, X-Container-Bytes-Used, X-Container-Meta-Quota-Count, X-Container-Meta-Quota-Bytes, X-Container-Read, X-Container-Write, X-Container-Sync-Key, X-Container-Sync-To
@JohannesRudolph
JohannesRudolph / fix-refresh-rate.sh
Last active November 30, 2020 08:27 — forked from judas-christ/fix-refresh-rate.sh
How to change refresh rate on an external display on macOS. Useful if for some reason macOS decides to no longer drive your 4k display at 60Hz and gives you no option to correct.
# install cscreen
brew cask install cscreen
# list displays
cscreen -l
# find your external screen in the list and write the number (not the ID) down somewhere
# in the following instructions, use that number instead of <SCREEN>
# list display modes for your external screen
@JohannesRudolph
JohannesRudolph / time-ago.pipe.spec.ts
Created December 1, 2016 09:58
Angular2 TimeAgo Pipe
import { fakeAsync, tick } from '@angular/core/testing';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/interval';
import 'rxjs/add/operator/takeWhile';
import { TimeAgoPipe } from './time-ago.pipe';
import { WrappedValue } from '@angular/core';
// Learning
@JohannesRudolph
JohannesRudolph / dashboard.json
Created July 3, 2019 05:25
grafana-repeat-dashboard-export-sample
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
@JohannesRudolph
JohannesRudolph / haproxy.cfg
Created September 21, 2017 16:20
HAProxy CORS config for Openstack Swift using radosgw - with fixed buffer issue
global
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
ca-base /etc/ssl/certs
crt-base /etc/ssl/private
ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS
@JohannesRudolph
JohannesRudolph / lazylibs.service.ts
Created May 7, 2017 16:53
Angular lazy library loader
import { Injectable, Inject } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { ReplaySubject } from 'rxjs/ReplaySubject';
import { DOCUMENT } from '@angular/platform-browser';
@Injectable()
export class LazylibsService {
private chartJs?: ReplaySubject<any>;
@JohannesRudolph
JohannesRudolph / TestflihtappDeployTeamcity.sh
Created January 26, 2012 22:04
Builds and deploys an App to testflightapp.com. Integrates with Teamcity.
#!/bin/bash
#
# testflightapp.com tokens
API_TOKEN="YOUR_API_TOKEN"
TEAM_TOKEN="YOUR_TEAM_TOKEN"
PRODUCT_NAME="RowMotion"
ARTEFACTS="$PWD/Artefacts"