Skip to content

Instantly share code, notes, and snippets.

@ynonp
ynonp / given.pl
Created March 25, 2012 22:24
given/when bug
use v5.14;
my $foo = 13;
given ( $foo ) {
when ( 1..10 ) { say "small" }
when ( 11..20 ) { say "medium" }
when ( 21..30 ) { say "large" }
default { say "unknown" }
}
@ynonp
ynonp / perms.pl
Created March 28, 2012 07:11
permutations game
use strict;
use warnings;
use v5.14;
use Algorithm::Combinatorics qw/combinations permutations/;
my @numbers = qw/2 4 6 8/;
my @ops = qw{* - + /};
my $goal = 25;
my %ops = (
main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QSslCertificate::~QSslCertificate(void)" (__imp_??1QSslCertificate@@QAE@XZ) referenced in function "public: void * __thiscall QSslCertificate::`scalar deleting destructor'(unsigned int)" (??_GQSslCertificate@@QAEPAXI@Z)
main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static void __cdecl QSslSocket::setDefaultCaCertificates(class QList<class QSslCertificate> const &)" (__imp_?setDefaultCaCertificates@QSslSocket@@SAXABV?$QList@VQSslCertificate@@@@@Z) referenced in function _main
main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class QList<class QSslCertificate> __cdecl QSslCertificate::fromPath(class QString const &,enum QSsl::EncodingFormat,enum QRegExp::PatternSyntax)" (__imp_?fromPath@QSslCertificate@@SA?AV?$QList@VQSslCertificate@@@@ABVQString@@W4EncodingFormat@QSsl@@W4PatternSyntax@QRegExp@@@Z) referenced in function _main
remotewls.
@ynonp
ynonp / filter_certs.cpp
Created April 22, 2012 09:12
filters out expired certificates
QList<QSslCertificate> cacerts = QSslCertificate::fromPath(capath);
QList<QSslCertificate> liveCerts;
QDateTime now = QDateTime::currentDateTime();
foreach ( QSslCertificate c, cacerts )
{
if ( c.expiryDate() > now )
{
liveCerts << c;
}
@ynonp
ynonp / index.html
Created April 22, 2012 19:15
html file
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Canny</title>
<style type="text/css">
canvas { border: 5px solid purple; }
div { width: 400px; margin: 0 auto; }
</style>
@ynonp
ynonp / a.pl
Created April 25, 2012 05:49
perl default var
while (<>) {
chomp;
print;
}

Part 1

  1. Use uname to get details on your machine. What is your kernel version ?

  2. What is your default shell ? What version is it ?

  3. Find a list of all connected users to your server

  4. Run ifconfig to get information about network connections. Did it work ?

@ynonp
ynonp / zombie.pl
Created May 8, 2012 07:50
cool zombies
use strict;
use warnings;
use v5.14;
package Zombie;
my $how_many_brainz_i_ate = 0;
sub new {
$('canvas').bind('vmousemove', function(e) {
e.preventDefault();
// other stuff to handle the event
});
@ynonp
ynonp / heredoc.pl
Created May 26, 2012 15:44
indented heredoc example
#############################################
#!/usr/intel/bin/perl
my $line1 = <<"DONEDONE";
yuval yuval yuval
DONEDONE
print $line1;