Skip to content

Instantly share code, notes, and snippets.

View bbkr's full-sized avatar

Pawel Pabian bbkr

View GitHub Profile
@bbkr
bbkr / gist:4930c5bb9abaa2211756
Last active September 3, 2015 21:44
Curl Easy NativeCall
use NativeCall;
class Curl::Easy is repr( 'CPointer' ) {
sub curl_easy_init ( ) returns Curl::Easy is native( 'libcurl' ) { * };
sub curl_easy_cleanup ( Curl::Easy ) is native( 'libcurl' ) { * };
method new ( ) {
curl_easy_init();
}
@bbkr
bbkr / currency.p6
Created July 4, 2012 17:11 — forked from masak/currency.p6
Having fun with currencies in Perl 6
enum Currency <EUR USD>;
multi rate(EUR) { 1.252 }
multi rate(USD) { 1.000 }
class Money {
has Real $.amount;
has Currency $.currency;
method convert_to(Currency $currency) {
@bbkr
bbkr / FelineHotel.pm
Last active October 13, 2015 20:48
JSON::RPC blogpost
class FelineHotel;
has %!rooms =
403 => {
'type' => 'Standard',
'equipment' => [ 'bed', 'bowl' ],
'price' => 64,
'available' => True,
},
406 => {
@bbkr
bbkr / Foo.pm
Last active March 31, 2016 23:46
use NativeCall;
unit module Foo;
my sub f1 () is native('libwhatever') { * }
my sub f2 (int) is native('libwhatever') { * }
my sub f3 (int, int) is native('libwhatever') { * }
my sub f4 (int, int, int) is native('libwhatever') { * }
my sub f5 (int, int, int, int) is native('libwhatever') { * }
my sub f6 (int, int, int, int, int) is native('libwhatever') { * }
my sub f7 (int, int, int, int, int, int) is native('libwhatever') { * }
@bbkr
bbkr / df.txt
Last active September 26, 2016 10:50
$ df -k -P # use 1024 blocks and suppress inode stats
Filesystem 1024-blocks Used Available Capacity Mounted on
/dev/disk3 1219749248 341555644 877937604 29% /
devfs 343 343 0 100% /dev
/dev/disk1s4 133638140 101950628 31687512 77% /Volumes/Untitled
map -hosts 0 0 0 100% /net
map auto_home 0 0 0 100% /home
map -fstab 0 0 0 100% /Network/Servers
//Pawel%20Pabian@biala-skrzynka.local./Data 1951417392 1837064992 114352400 95% /Volumes/Data
/dev/disk5s2 1951081480 1836761848 114319632 95% /Volumes/Time Machine Backups
@bbkr
bbkr / template_engines.p6
Last active February 28, 2017 18:16
Template engines
use v6;
my $template = q{
Hi [VARIABLE person]!
You can change your password by visiting [VARIABLE link] .
Best regards.
};
@bbkr
bbkr / README.txt
Last active January 19, 2019 08:05
Asynchronous junkie
I love Perl 6 asynchronous features. They are so easy to use and can give instant boost by changing few lines of code that I got addicted to them. I became asynchronous junkie. And finally overdosed. Here is my story...
I was processing a document that was divided into chapters, sub-chapters, sub-sub-chapters and so on. Parsed to data structure it looked like this:
my %document = (
'1' => {
'1.1' => 'Lorem ipsum',
'1.2' => {
'1.2.1' => 'Lorem ipsum',
'1.2.2' => 'Lorem ipsum'
@bbkr
bbkr / foo.t
Created September 7, 2015 18:32
Running Perl 6 test from Perl 5
my $parser = TAP::Parser->new( { "exec" => [ 'perl6', $FindBin::Bin . '/api/' . $method . '.t' ] } );
while ( my $result = $parser->next ) {
next unless $result->is_test;
ok $result->is_ok, $result->description;
}
@bbkr
bbkr / log.txt
Created August 1, 2019 21:08
shield tv log
08-01 23:03:11.219 13836 14202 D Retrofit: --> GET https://gfnpc.api.entitlement-prod.nvidiagrid.net/v2/apps?languageCode=en_US&countryCode=PL&vpcId=NP-STH-01&serviceName=gfn_pc
08-01 23:03:11.677 13836 14202 D Retrofit: <-- 200 https://gfnpc.api.entitlement-prod.nvidiagrid.net/v2/apps?languageCode=en_US&countryCode=PL&vpcId=NP-STH-01&serviceName=gfn_pc (457ms, 184117-byte body)
08-01 23:03:11.699 13836 14202 W ContentProvider: Normalized content://com.nvidia.pgcontentprovider.PGContentProvider//default/gameinfo/1 to content://com.nvidia.pgcontentprovider.PGContentProvider/default/gameinfo/1 to avoid possible security issues
08-01 23:03:11.796 3688 3838 E WifiVendorHal: getWifiLinkLayerStats(l.937) failed {.code = ERROR_NOT_AVAILABLE, .description = }
08-01 23:03:12.006 13836 14202 D UnifiedAPIException: RequestException :: createException
08-01 23:03:12.007 13836 14202 E UnifiedAPIException: Throwing 403 exception
08-01 23:03:12.007 13836 14202 D UnifiedAPIException: RequestStatus: <?xml version="1.0" enco
RIDDLE:
https://dev.to/nombrekeff/challenge-can-you-solve-this-puzzle-1947
ANSWER:
Oh, Ann, please kiss me dry!
CLUES:
* Decoded ASCII message with correct punctuation suggests some kind of early character based encryption (not full binary encryption).