Skip to content

Instantly share code, notes, and snippets.

View nlitsme's full-sized avatar

willem nlitsme

View GitHub Profile
@nlitsme
nlitsme / lsq.pl
Last active August 29, 2015 14:08
calculate least squares approximations of input data for several expressions
#!perl -w
# vim: sw=4 ts=4 et :
# (C) 2003-2007 Willem Jan Hengeveld <itsme@xs4all.nl>
# Web: http://www.xs4all.nl/~itsme/
# http://wiki.xda-developers.com/
#
# $Id: $
#
# http://en.wikipedia.org/wiki/Linear_regression
# http://mathworld.wolfram.com/LeastSquaresFitting.html
@nlitsme
nlitsme / transpose.pl
Last active August 29, 2015 14:08
transpose columns and rows of input
#!/usr/bin/perl -w
# (C) 2003-2007 Willem Jan Hengeveld <itsme@xs4all.nl>
# Web: http://www.xs4all.nl/~itsme/
# http://wiki.xda-developers.com/
#
# $Id$
#
# script that transposes a tab separated matrix
use strict;
@nlitsme
nlitsme / urldecode.pl
Last active August 29, 2015 14:08
decode url from stdin
#!/usr/bin/perl
# (C) 2003-2007 Willem Jan Hengeveld <itsme@xs4all.nl>
# Web: http://www.xs4all.nl/~itsme/
# http://wiki.xda-developers.com/
#
# $Id$
#
use strict;
# this script decodes urls listed on stdin.
@nlitsme
nlitsme / which.pl
Last active August 29, 2015 14:08
list all instances of an executable in your search PATH
#!/usr/bin/perl -w
# (C) 2003-2007 Willem Jan Hengeveld <itsme@xs4all.nl>
# Web: http://www.xs4all.nl/~itsme/
# http://wiki.xda-developers.com/
#
# $Id$
#
use strict;
@nlitsme
nlitsme / cmpbin.pl
Last active August 29, 2015 14:08
print different dwords between two files
use strict;
use warnings;
use IO::File;
sub readbin {
my $fn= shift;
my $fh= IO::File->new($fn, "r") or die "$fn: $!\n";
binmode $fh;
my $data;
$fh->read($data, -s $fn);
$fh->close();
@nlitsme
nlitsme / xml2pl.pl
Last active August 29, 2015 14:08
make apple .plist files more readable, translating them to perlish
#!/usr/bin/perl -w
# (C)2009 Willem Hengeveld itsme@xs4all.nl
use strict;
use MIME::Base64;
local $/;
# script to convert macosx .plist xml files to perl, this makes them much more readable
# NOTE: there is also "/usr/libexec/PlistBuddy -c Print x.plist"
#
#
@nlitsme
nlitsme / xpcap.pl
Last active August 29, 2015 14:08
parse tcpdump output, to display tcp and udp data streams in hex
#!/usr/bin/perl -w
use strict;
use Compress::Zlib;
use Getopt::Long;
Getopt::Long::Configure ("bundling");
# xpcap shows the payloads of udp and tcp connections, parsing
# the output of tcpdump -x
$|=1;
@nlitsme
nlitsme / g0.sh
Created November 4, 2014 18:30
combine find, xargs and grep in one command
#!/bin/bash
GREPARGS=()
FINDPATHS=()
while [[ $# != 0 ]]; do
if [[ -d "$1" ]]; then
FINDPATHS+=("$1")
else
GREPARGS+=("$1")
fi
shift
@nlitsme
nlitsme / switchgcc.sh
Created May 3, 2017 23:48
Bash script for switching the current gcc compiler.
if [[ -z "$1" ]]; then
exit 1
fi
if [[ -e $1/bin/avr-gcc-7.1.0 ]]; then
cppopt=gnu++1z
elif [[ -e $1/bin/avr-gcc-4.9.2 ]]; then
cppopt=gnu++11
else
echo unknown compiler version
"""
Python script for finding a still available pretty phonenumber on the sha2017 POC network.
Register your phone number on: https://poc.sha2017.org/
Author: Willem Hengeveld <itsme@xs4all.nl>
This code is released under the Beerware license.
"""
from __future__ import print_function