Skip to content

Instantly share code, notes, and snippets.

Avatar

Piotr Roszatycki dex4er

View GitHub Profile
@dex4er
dex4er / http2http.pm
Created Dec 18, 2011
HTTP to HTTPS proxy server
View http2http.pm
#!/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 Jan 19, 2018
10 Perl One Liners to Impress Your Friends
View 10_oneliners.ls
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 Jan 19, 2012
VPN via interactive session
View expect.pl
#!/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;
View ubuntu_tweaks.sh
gsettings set com.canonical.Unity.Panel systray-whitelist "['all']"
View bin2bin.pl
#!/usr/bin/perl
use strict;
use IPC::Open2;
use IO::Select;
use IO::Handle;
use constant {
BUFLEN => 1024 * 4,
@dex4er
dex4er / app.l4p
Created Mar 7, 2012
Default PSGI application
View app.l4p
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
View local_var_1_1.pl
foreach my $n (1..3) {
say $n;
}
# a tu już $n nie działa
View cpan-import-all-example.sh
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 Apr 15, 2012
perlbrew wrapper
View perlbrew.sh
#!/bin/bash
perlbrew=/usr/bin/perlbrew
export PERLBREW_ROOT="$HOME/opt/perlbrew"
if [ ! -f "$PERLBREW_ROOT/etc/bashrc" ]; then
$perlbrew init
fi