Skip to content

Instantly share code, notes, and snippets.

View jreisinger's full-sized avatar
👋
hello friend

Jozef Reisinger jreisinger

👋
hello friend
View GitHub Profile
@jreisinger
jreisinger / var-vs-arg.pl
Last active September 30, 2015 04:38
Global variable vs. function with argumet
#
# 1. global variable
#
my $num = 2;
exp();
sub exp {
return $num * $num;
}
"" filetype
filetype plugin on
set ofu=syntaxcomplete#Complete " omni completion
syntax enable
"" indenting
set tabstop=2
set shiftwidth=2
"set expandtab " spaces instead of tab
set autoindent
"" statusline
@jreisinger
jreisinger / gist:2152894
Created March 21, 2012 21:14
return list
def sum(a, b):
sum = a + b
return("the sum is", sum)
#!/usr/bin/env python
file = "/etc/passwd"
file_object = open(file, 'r')
shell = {}
for line in file_object:
line = line.strip()
fields = line.split(":")
shell[fields[0]] = fields[-1]
@jreisinger
jreisinger / mygrep.pl
Created October 20, 2012 17:11
mygrep
#!/usr/bin/perl
# Leave out comments and highlight regex
# Usage: $ mygrep [regex] <file>
# to compress blank lines: $ mygrep [regex] <file> | perl -00pe0
use strict;
use warnings;
use Term::ANSIColor;
my $regex = shift unless -f $ARGV[0];
@jreisinger
jreisinger / sort.pl
Created March 2, 2013 13:55
Change mtime of files so they sort on TV
#!/usr/bin/perl
# Change mtime of files so they sort on TV.
use strict;
use warnings;
use 5.010;
use File::Find;
die "Usage: $0 <dir(s)>\n" unless @ARGV;
my @files;
@jreisinger
jreisinger / orsr.pl
Created March 21, 2013 12:22
DON'T EDIT/REMOVE - referred to in http://perlmonks.org/?node_id=1024748
#!/usr/bin/perl
# Which companies are the names associated with?
use strict;
use warnings;
use HTML::LinkExtor;
use LWP::Simple;
use URI::Encode qw(uri_encode);
my $names_file = shift;
@jreisinger
jreisinger / gist:5395058
Created April 16, 2013 10:55
Filter out records by column and regular expression
#!/usr/bin/perl
# Filter out records by column and regular expression
use strict;
use warnings;
use 5.010;
use Text::CSV_XS;
my $file = shift;
my $separator = shift // ';';
'1' OR '1' = '1'
1'%20or%20'1'%20=%20'1
----
UserName='1'%20or%20'1'%20=%20'1'
Password=1%27+or+%271%27+%3D+%271
==> Incorrect syntax near '1'.
----
1%27+or+%271%27+%3D+%271
1%27+or+%271%27+%3D+%271
==> Chybné heslo!
@jreisinger
jreisinger / LDAP client
Created May 13, 2013 20:51
LDAP client
#!/usr/bin/perl
use strict;
use warnings;
use Net::LDAP;
my $ldap = Net::LDAP->new("dom0.dyndns.org") or die $@;
$ldap->bind();
my $base_dn = "dc=dom0,dc=dyndns,dc=org";