Skip to content

Instantly share code, notes, and snippets.

@import url(https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic);
@import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic);
@page {
size: 1210px 681px;
margin: 0;
}
@media print {
.remark-slide-scaler {
@berekuk
berekuk / html2vk.py
Created April 15, 2017 16:36
html2vk
#!/usr/bin/env python3
import argparse
from bs4 import BeautifulSoup
import requests
import urllib.parse
import re
def extract_tumblr_content(soup):
item = soup.find(class_='post-content')

Keybase proof

I hereby claim:

  • I am berekuk on github.
  • I am berekuk (https://keybase.io/berekuk) on keybase.
  • I have a public key whose fingerprint is A742 E40C 51FD BA2A 27E1 5E9F 3D2A 774C 5489 F96C

To claim this, I am signing this object:

@berekuk
berekuk / custom-status-check.pm
Created November 30, 2013 17:53
Ubic custom status checks example
# two options:
# 1) put it into Ubic::Service::Starman::WithFileChangeDetection, and reuse it in multiple ubicservice configs;
# in this case, you'll have to add [package ...] line here
# 2) put it directly into service config; in this case, you don't need package line
use strict;
use warnings;
use parent qw(Ubic::Service::Starman); # or whatever you use
use Ubic::Result qw(result);
@berekuk
berekuk / MyService.pm
Created October 8, 2013 19:28
ubic custom commands
...
sub custom_commands { qw( foo bar ) };
sub do_custom_command {
my ($self, $command) = @_;
if ($command eq "foo") {
... # do action "foo"
}
elsif ($command eq "bar") {
... # do action "bar"
@berekuk
berekuk / test-moo.pl
Last active December 18, 2015 04:59
moo-multi-before-with-moose
#!/usr/bin/env perl
# This code is working.
package R1;
use Moo::Role;
before 'foo', 'bar' => sub {
print "before\n";
};
@berekuk
berekuk / wget-invalid.txt
Last active December 18, 2015 01:38
EC2 wrong response
### This is riotgames headers and html
mmcleric@mmbook:~$ wget -S -O - 'http://questhub.io'
--2013-06-04 03:39:28-- http://questhub.io/
Resolving questhub.io... 54.225.128.184
Connecting to questhub.io|54.225.128.184|:80... connected.
HTTP request sent, awaiting response...
HTTP/1.1 200 OK
Cache-Control: must-revalidate
Content-Type: text/html; charset=utf-8
#!/usr/bin/env perl
use strict;
use warnings;
use Coro;
use Coro::AnyEvent;
my $param;
sub param {
#!/usr/bin/env perl
use Dancer2;
use Coro::AnyEvent;
set logger => 'console';
set log => 'core';
get '/:foo' => sub {
Coro::AnyEvent::sleep 1;
@berekuk
berekuk / test.txt
Created May 14, 2013 10:34
Dancer::Request from env issue
$ perl -e 'use Dancer::Request; Dancer::Request->new(env => { REQUEST_METHOD => "GET", REQUEST_URI => "/", PATH_INFO => "/", QUERY_STRING => "", HTTP_foo => "abc" })->header("foo")'
Can't call method "header" on an undefined value at /Users/mmcleric/perl5/perlbrew/perls/perl-5.16.1/lib/site_perl/5.16.3/Dancer/Request.pm line 92, <DATA> line 1003.