Skip to content

Instantly share code, notes, and snippets.

@bert2002
bert2002 / gist:8d31b4e6a341b048538771b328fa9144
Created August 22, 2022 15:49
Setup a docker based AIT3 devnet of Aptos
#!/bin/bash
# author: bert2002
# script: install a ait3 devnet node for Aptos
# notes:
# - docker must be installed
# - dont run as root ; the user needs to be able to run docker (aka in the docker group)
# - the monitoring port is at port 80 and not port 8080 as default in the registration
# - run the script in a screen session
# - the key informations are in $BASE/$WORKSPACE/keys
# - to reset, rm -rf testnet
@bert2002
bert2002 / fb_oauth.pl
Last active August 29, 2015 14:06
Mojolicious with Facebook OAuth2
#!/usr/bin/env perl
use Mojolicious::Lite;
use Net::Facebook::Oauth2;
my $config = {
facebook => {
app_id => '',
secret => '',
redirect_url => 'http://mojo.dev:3000/redirect_from_fb',
},
@bert2002
bert2002 / munin.conf
Created September 12, 2014 19:11
Apache 2.4 und Munin 2 Vhost configuration
Alias /munin /var/cache/munin/www
<Directory "/var/cache/munin/www">
AuthUserFile /etc/apache2/munin.pw
AuthName "Restricted"
AuthType Basic
require valid-user
</Directory>
RewriteEngine On
@bert2002
bert2002 / xmlrpcblock.sh
Created August 31, 2014 15:50
Block xmlrpc.php attacks
#!/bin/bash
# script: block xmlrpc attacks
# author: Steffen Wirth <s.wirth@itbert.de>
LOGFILE="/var/log/apache2/access.log"
LASTLINES="20"
MAXCOUNT="5"
LIST=$(tail -n$LASTLINES $LOGFILE |grep "xmlrpc.php" | awk '{print $1}' | sort -n | uniq -c)
@bert2002
bert2002 / favorite_soundcloud_download_plus.pl
Created August 18, 2014 17:51
download all of your favorite songs from soundcloud
#!/usr/bin/perl
# script: download favorite songs from your soundcloud stream
# author: Steffen Wirth <s.wirth@itbert.de>
use WebService::Soundcloud;
use XML::Simple;
use HTTP::Cookies;
use LWP::Simple;
use Encode qw(encode_utf8);
no warnings 'utf8';
@bert2002
bert2002 / favorite_soundcloud_download.pl
Last active August 29, 2015 14:05
download favorite songs from your soundcloud stream
#!/usr/bin/perl
# script: download favorite songs from your soundcloud stream
# author: Steffen Wirth
use WebService::Soundcloud;
use XML::Simple;
no warnings 'utf8';
# create a new app -> soundcloud.com/you/apps/new
my $client_id = "YOUR_CLIEND_ID";
@bert2002
bert2002 / ac3tomp3.sh
Created June 20, 2014 19:26
Convert AC3 to MP3 in a MKV file
#!/bin/bash
# script: convert AC3 to MP3 in MKV container
# author: bert2002 <s.wirth@itbert.de>
FILE=$1
FILENAME=$(basename $FILE mkv)
AC3AUDIO=$(mkvmerge --identify $FILE |grep "AC3" | awk -F':' '{print $1}' | awk '{print $3}')
mkvextract tracks $FILE $AC3AUDIO:${FILENAME}ac3
ffmpeg -i ${FILENAME}ac3 -acodec libmp3lame -ab 160k -ac 2 ${FILENAME}mp3
@bert2002
bert2002 / check_disk.php
Last active August 29, 2015 13:56
small nagios check_disk wrapper to trigger through php
<?php
// global binary
$NAGIOS_DISK = "/usr/lib/nagios/plugins/check_disk";
$DISK_KEY = "Uvg2kFMfy3DU";
if (isset($_GET['key'], $_GET['w'], $_GET['c'])) {
// okay
$key = $_GET['key'];
$warning = $_GET['w'];
@bert2002
bert2002 / ossh.sh
Last active August 29, 2015 13:56
list open ssh connections and show menu to connect
#!/bin/bash
# Description: Show current ssh client connections and
# establish further one if requested.
set -e
# Define optional exclude regex.
EXCLUDE_RE=""
count=1
ssh_client_pids=$( lsof -n -iTCP -sTCP:ESTABLISHED | awk '/^ssh/{print
@bert2002
bert2002 / postwordpress.pl
Created August 6, 2012 12:43
publish article to a wordpress blog using XMLRPC interface. Uploading a picture and setting this as a featured image. Additionally add custom fields.
#!/usr/bin/perl
# script: publish article to a wordpress blog using XMLRPC interface. Uploading a picture and setting this as a featured image. Additionally add custom fields.
# author: <bert2002>
use strict;
use utf8;
use XMLRPC::Lite;
use IO::Socket::SSL;
my ($buf,$contents);