Skip to content

Instantly share code, notes, and snippets.

View andyHa's full-sized avatar

Andreas Haufler andyHa

View GitHub Profile
@andyHa
andyHa / magic.rs
Last active July 12, 2021 02:46
Some weekend fun: Simple Rust, complex maths and having fun in the terminal..
//! # Some weekend fun: Simple Rust, complex maths and having fun in the terminal..
//!
//! Let's start with a quick thought experiment: If you take a number, e.g. 4 and square it,
//! (16) and square it again (256) you quickly realize the numbers run towards infinity. This
//! is true for all numbers, right? Well, not quite. Everything between -1..1 will converge
//! towards 0 rather than infinity.
//!
//! So for real numbers this is quite boring. However, if we step it up to complex numbers, we
//! have a 2D plane and could render a nice chart...
//!
// Debug using /usr/bin/log stream --process Phoenix
new Key('right', [ 'ctrl', 'cmd' ], function () {
try {
Phoenix.log("Right")
var wnd = Window.focused();
if (!wnd) {
return;
@andyHa
andyHa / phoenix.js
Created April 27, 2018 07:34
My phoenix config
// Debug using log stream --process Phoenix
new Key('right', [ 'ctrl', 'cmd' ], function () {
var wnd = Window.focused();
if (!wnd) {
return;
}
if (!wnd.screen()) {
return;
@andyHa
andyHa / .phoenix.js
Last active November 25, 2015 08:07
/**
* Use with: https://github.com/kasper/phoenix
*
* I start my apps using F-keys provided by the apple keyboard which are
* otherwise rigorously ignored by other applications.
*
* ^ + CMD + <- and -> move windows from one screen to another
* ^ + CMD + UP maximizes the current window
* CMD + < cycles through windows of the current application
**/
Watch w = Watch.start();
int msgs = 10_000_000;
AtomicInteger received = new AtomicInteger();
for (int i = 0; i < msgs; i++) {
Async.defaultExecutor().start(() -> {
Async.defaultExecutor().start(() -> {
int numReceived = received.incrementAndGet();
if (numReceived % 500_000 == 0) {
System.out.println(numReceived + " " + w.duration());
}
@andyHa
andyHa / xtool.sh
Last active February 9, 2024 08:13
X-Tool - A super small but handy tool to call frequently used shell commands...
#
# Made with all the love in the world
# by scireum in Remshalden, Germany
#
# Copyright by scireum GmbH
# http://www.scireum.de - info@scireum.de
# written by Andreas Haufler (aha@scireum.de)
# Licensed under the MIT license: http://opensource.org/licenses/MIT
#
# X-TOOL provides a very simple tool for invoking frequent commands.