Skip to content

Instantly share code, notes, and snippets.

@three18ti
three18ti / check_dbd2.pl
Last active August 29, 2015 14:08
Check connection to DBD2
use 5.010;
use warnings;
use strict;
use DBI;
use DBD::DB2;
say "Operating System = " . $^O;
say "Perl Binary = " . $^X;
say "Perl Version = " . $];
say "DBI Version = " . $DBI::VERSION;
@three18ti
three18ti / install.txt
Last active August 29, 2015 14:02
Calamari installation (for a dev environment)
1) Install all packages, including nodejs and npm (I always install build essential on dev machines, I've included it here for accuracy)
2) install grunt and compass
3) set environment variables
4) checkout calamari to /opt/workspace
5) create virtualenv
6) activate virtualenv (very important step I was missing on my first run through, it's implied but I'm not well versed in Python so it was definitely an "Ah ha!" moment)
7) use pip to install dependencies, the `pip install -r requirements/debian/requirements.force.txt` tends to complete with an already satisfied." but I continue to run it anyway.
8) Checkout calamari-clients to alternate directory
9) run make dist on calamari-clients directory
10) copy resulting contents to your webapp/contents directory (`make dist`, `make build-real`, or `make ui`, which is correct? there's a tarball that's involved somehow too... what's the deal with that?)
package Foo::Bar;
use strict;
use warnings;
1;
#!/usr/bin/env perl
use 5.010;
use strict;
use warnings;
BEGIN {
eval {
require 'lib/Foo.pm';
};
print $@;
package My::App;
use 5.010;
use Moose;
use strict;
use warnings;
use MooseX::HasDefaults::RO;
has [qw( foo bar )] => (
isa => 'Int',
required => 1,
770
404
718
203
901
305
312
313
215
803
#!/usr/bin/env perl
use strict;
use warnings;
use Data::Dumper;
$Data::Dumper::Deparse = 1;
# syntactic sugar
sub NEXTVAL { $_[0]->() }
sub Iterator (&) { return $_[0] }
PRAGMA foreign_keys = ON;
BEGIN TRANSACTION;
DROP TABLE IF EXISTS server;
CREATE TABLE server (
id INTEGER PRIMARY KEY,
name VARCHAR UNIQUE,
notes VARCHAR
);
@three18ti
three18ti / truth_in_values.pl
Last active December 20, 2015 21:39
Truth test perl
#!/usr/bin/perl
use strict;
use warnings;
use 5.010;
%hash ? say "Empty Hash is true" : say "Empty Hash is false" ;
scalar keys %hash > 0 ? say "Empty Hash is true" : say "Empty Hash is false" ;
%hash = ( foo => 1, bar => 2 );
import os
import sys
import platform
import shutil
import cPickle
org_state_file_path = os.path.expanduser('~/.config/deluge/state/torrents.state')
new_state_file_path = os.path.expanduser('~/torrents.state.new')
state_file_org = open(org_state_file_path, 'rb')