Skip to content

Instantly share code, notes, and snippets.

Avatar

Karl Matthias relistan

View GitHub Profile
@relistan
relistan / README.md
Last active Sep 6, 2022
Enable CAT control for WSJT-X on the (tr)uSDX on macOS
View README.md

CAT Control on the (tr)uSDX for WSJT-X on macOS

This will enable CAT control on your Mac running WSJT-X with the (tr)uSDX and possibly other USDX rigs as well. WSJT-X uses Hamlib to connecto to and manage CAT on different radios. The problem (thanks to Guido PE1NNZ for identifying), is that Hamlib resets the port when it connects. This causes the radio to reset and then it's not yet available when Hamlib tries to connect. We can work around that by blocking the ability for Hamlib to reset the port. The simplest way to do that is to have the port already in use when Hamlib starts up.

I was not able to achieve that using the Hamlib built into WSJT-X. However, by installing Hamlib separately,

@relistan
relistan / connect.rb
Last active Feb 16, 2022
Connecting to Cassandra/SSL from JRuby with Datastax driver
View connect.rb
def connect(addresses, dc_name)
builder = CqlSession.builder()
.withLocalDatacenter(dc_name)
addresses.each do |a|
(host, port) = a.split(/:/)
port ||= 9042
builder
.addContactPoint(InetSocketAddress.new(host.to_java_string, port.to_i))
.withAuthCredentials('[redacted]', '[redacted]')
@relistan
relistan / env_var.cr
Created Sep 29, 2019
Crystal Lang Env Var Mapping
View env_var.cr
module EnvVar
# Fetch a key from the environment, or set a default if the key
# is missing. If the default is nil, abort and request that the
# required key be set.
def get_env(key : String, default : String?, nilable : Bool) : String?
ENV[key]
rescue KeyError
if default.nil? && !nilable
abort "You must set a value for env var '#{key}'"
else
View Keybase.md

Keybase proof

I hereby claim:

  • I am relistan on github.
  • I am relistan (https://keybase.io/relistan) on keybase.
  • I have a public key ASAFN-_0eLk8YPjMdYWgLmXs9RxtcSbJmdQLMUXSLcG1fQo

To claim this, I am signing this object:

@relistan
relistan / env_var_provider.ex
Last active Dec 18, 2018
Elixir Distillery Env Var Provider
View env_var_provider.ex
defmodule EnvVar.Provider do
use Mix.Releases.Config.Provider
require Logger
def init(app: app, prefix: prefix, env_map: env_map) do
persist(app, prefix, env_map)
end
# E.g.
@relistan
relistan / Dockerfile
Created Dec 5, 2017
Sidecar Envoy Docker container
View Dockerfile
FROM envoyproxy/envoy:v1.5.0
RUN apt-get update
COPY envoy.yaml /etc/envoy.yaml
ADD run.sh /run.sh
CMD /run.sh
View postgres_queries_and_commands.sql
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@relistan
relistan / blockingreader.go
Last active Sep 7, 2021
block-docker-container
View blockingreader.go
package main
import (
"fmt"
"io"
"os"
"github.com/fsouza/go-dockerclient"
)
View logback_test.java
package hello;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class MyApp1 {
final static Logger logger = LoggerFactory.getLogger(MyApp1.class);
private static void setDefaultUncaughtExceptionHandler() {
try {
@relistan
relistan / kafkamon.scala
Created Mar 14, 2016
Kafka Offset Monitor
View kafkamon.scala
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*