Skip to content

Instantly share code, notes, and snippets.

View haodemon's full-sized avatar
:octocat:
compiling...

Alfred S. haodemon

:octocat:
compiling...
  • IPONWEB
  • Berlin, Germany
  • 03:28 (UTC +02:00)
View GitHub Profile
@haodemon
haodemon / OAuthGoogleTokenProvider.scala
Created August 7, 2021 19:34
GKE Google Kubernetes fabric8 OAuthTokenProvider
import io.fabric8.kubernetes.client.OAuthTokenProvider;
class OAuthGoogleTokenProvider extends OAuthTokenProvider {
private val binary = "gcloud"
private val args = "config config-helper --format=json"
override def getToken: String = {
val response = (binary + " " + args).!!
val token = new ObjectMapper().readTree(response)
.get("credential")
from astropy.io import fits
import numpy as np
import time
from statistics import median
# returns mean for each pixel position in files
def median_fits(files):
start = time.perf_counter()
data = np.array([ fits.open(f)[0].data for f in files ])
_, h, w = data.shape
@haodemon
haodemon / README.md
Created February 9, 2018 10:37 — forked from magnetikonline/README.md
Bash string manipulation cheatsheet.

Bash string manipulation cheatsheet

Removal
Delete shortest match of needle from front of haystack ${haystack#needle}
@haodemon
haodemon / quicksort.pl
Created December 2, 2017 18:46
Eloquent quicksort implementation (Perl)
#!/usr/bin/env perl
use strict;
use warnings;
use Test::Deep;
sub quicksort {
return unless @_;
@haodemon
haodemon / selection_sort.pl
Created August 30, 2017 01:14
Do not use in prod. Augmented due to boredom on an airplane - ran out of books to read and wanted to scare a nice fellow sitting to the right of me. Hey!
#!/usr/bin/env perl
use 5.016;
use strict;
use warnings;
sub array_to_string($) {
'[' . join(', ', @{$_[0]}) . '];';
#!/usr/bin/env perl
use 5.016;
use strict;
use warnings;
sub array_minus(\@\@) {
my %e = map{ $_ => undef } @{$_[1]};