Skip to content

Instantly share code, notes, and snippets.

View nunorc's full-sized avatar

Nuno Ramos Carvalho nunorc

View GitHub Profile
import lightkurve as lk
# retrieve the light curve file
lcf = lk.search_lightcurvefile('kepler-427', quarter=6).download()
# retrive the PDFSAP light curve from the file
lc = lcf.PDCSAP_FLUX
# plot the light curve
lc.plot()

Keybase proof

I hereby claim:

  • I am nunorc on github.
  • I am nrc (https://keybase.io/nrc) on keybase.
  • I have a public key whose fingerprint is 94AA 2B5B 468C 83A4 E885 A779 C733 5AEC DFC6 223D

To claim this, I am signing this object:

@nunorc
nunorc / gist:3451005
Created August 24, 2012 14:09
JSON::Diffable fix Makefile.PL typo
diff --git a/Makefile.PL b/Makefile.PL
index 7c5ca12..3a4b73f 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -19,7 +19,7 @@ my $mymeta = do { no warnings; $ExtUtils::MakeMaker::VERSION >
WriteMakefile(
NAME => 'JSON-Diffable',
- VERSION_FROM => 'lib/JSON/Diffable.pm'
+ VERSION_FROM => 'lib/JSON/Diffable.pm',
@nunorc
nunorc / gist:3416716
Created August 21, 2012 15:45
Just for kicks!
$ cat documentation_init.patch
diff --git a/lib/System/Introspector.pm b/lib/System/Introspector.pm
index c46af7d..8316545 100644
--- a/lib/System/Introspector.pm
+++ b/lib/System/Introspector.pm
@@ -5,6 +5,37 @@ package System::Introspector;
our $VERSION = '0.000001';
$VERSION = eval $VERSION;
-# lots of this stuff sponsored by socialflow.com
use List::Utils;
sub beadsort(@l) {
(transpose(transpose(map {[1 xx $_]}, @l))).map(*.elems);
}
my @list = 2,1,3,5;
say beadsort(@list).perl; # (5, 3, 2, 1)
$ cat test.p6
multi f([]) { () }
multi f(@list) {
say @list.perl;
}
my @a = ();
f(@a);
Create a list of four times 1:
Main> flip replicate 1 4
[1,1,1,1]
Now do it for every element of the list and get a list of lists:
Main> map (flip replicate 1) [4,1,3,2]
[[1,1,1,1],[1],[1,1,1],[1,1]]
Transpose that twice to get the inner lists sorted by number of elements:
Main> transpose(transpose(map (flip replicate 1) [4,1,3,2]))
$ cat ABC.pm
grammar ABC::Grammar is HLL::Grammar {
rule TOP { <expr> }
rule expr { <integer> <addop> <integer> };
token addop { '+' | '-' }
token integer { \d+ }
}
class ABC::Actions is HLL::Actions {
$ perl rakudo/tools/bench.pl
hello.p6
rakudo-2010.07: 3.873719 seconds
rakudo-master: 3.674719 seconds
rakudo-star: 3.635399 seconds
iteration.p6
rakudo-2010.07: 3.819951 seconds
rakudo-master: 3.841175 seconds
rakudo-star: 3.683934 seconds
recursion.p6
diff --git a/src/core/IO/Socket/INET.pm b/src/core/IO/Socket/INET.pm
index 63d8f4d..9acaf55 100644
--- a/src/core/IO/Socket/INET.pm
+++ b/src/core/IO/Socket/INET.pm
@@ -2,7 +2,7 @@ class IO::Socket::INET is Cool does IO::Socket {
method open (Str $hostname, Int $port) {
- Q:PIR {
+ my $s = Q:PIR {