Removal | |
---|---|
Delete shortest match of needle from front of haystack |
${haystack#needle} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Test::Deep; | |
sub quicksort { | |
return unless @_; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use 5.016; | |
use strict; | |
use warnings; | |
sub array_to_string($) { | |
'[' . join(', ', @{$_[0]}) . '];'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use 5.016; | |
use strict; | |
use warnings; | |
sub array_minus(\@\@) { | |
my %e = map{ $_ => undef } @{$_[1]}; |