Skip to content

Instantly share code, notes, and snippets.

View dex4er's full-sized avatar

Piotr Roszatycki dex4er

  • Berlin, Germany
View GitHub Profile
@dex4er
dex4er / http2http.pm
Created December 18, 2011 21:01
HTTP to HTTPS proxy server
#!/usr/bin/env perl -c
package App::http2http;
=head1 NAME
App::http2http - generic HTTP proxy server with logging
=cut
@dex4er
dex4er / 10_oneliners.ls
Last active January 19, 2018 21:08
10 Perl One Liners to Impress Your Friends
global import require 'prelude-ls'
# or "lsc -d" command
# 1. Multiple Each Item in a List by 2
list = [1 to 10] |> map (* 2)
list.for-each (n) !-> console.log n
# 2. Sum a List of Numbers
n = sum [1 to 1000]
console.log n
@dex4er
dex4er / expect.pl
Created January 19, 2012 15:09
VPN via interactive session
#!/usr/bin/perl
# expect.pl (c) 2012 Piotr Roszatycki <dexter@debian.org>
use strict;
use Expect;
die "Usage: $0 cmd [-echo] expect1 send1 expect2 send2 ...\n"
unless @ARGV;
@dex4er
dex4er / ubuntu_tweaks.sh
Created January 26, 2012 11:23
Ubuntu tweaks
gsettings set com.canonical.Unity.Panel systray-whitelist "['all']"
@dex4er
dex4er / bin2bin.pl
Created February 8, 2012 21:17
hexcodec
#!/usr/bin/perl
use strict;
use IPC::Open2;
use IO::Select;
use IO::Handle;
use constant {
BUFLEN => 1024 * 4,
@dex4er
dex4er / app.l4p
Created March 7, 2012 15:00
Default PSGI application
log4perl.logger.plack = DEBUG, LogfilePlack
log4perl.appender.LogfilePlack = Log::Dispatch::File::Stamped
log4perl.appender.LogfilePlack.stamp_fmt = %Y-%m-%d
log4perl.appender.LogfilePlack.filename = log/error.log
log4perl.appender.LogfilePlack.layout = PatternLayout
log4perl.appender.LogfilePlack.layout.ConversionPattern = %d{ISO8601}: %c: %m{chomp}%n
log4perl.logger.access = DEBUG, LogfileAccess
log4perl.appender.LogfileAccess = Log::Dispatch::File::Stamped
log4perl.appender.LogfileAccess.stamp_fmt = %Y-%m-%d
@dex4er
dex4er / local_var_1_1.pl
Created March 13, 2012 19:38
Perlowo 2012-03-13
foreach my $n (1..3) {
say $n;
}
# a tu już $n nie działa
#!/usr/bin/env perl
cpan-import-all.sh http://cpan.metacpan.org/authors/id/D/DE/DEXTER/Symbol-Util-0.0203.tar.gz --sign-tags
@dex4er
dex4er / perlbrew.sh
Created April 15, 2012 18:43
perlbrew wrapper
#!/bin/bash
perlbrew=/usr/bin/perlbrew
export PERLBREW_ROOT="$HOME/opt/perlbrew"
if [ ! -f "$PERLBREW_ROOT/etc/bashrc" ]; then
$perlbrew init
fi