Skip to content

Instantly share code, notes, and snippets.

View gist:64850a3c2dc8f6b0f8d26747760b7b6f
reneeb@host:~$ perl -MDateTime -E 'my $month; my $date = DateTime->new(day=> 7, month=>11, year=>2021); $date->month() < 10 ? $month = $date->month() : $month = "0" . $date->month(); say $month'
011
reneeb@host:~$ perl -MDateTime -E 'my $month; my $date = DateTime->new(day=> 7, month=>8, year=>2021); $date->month() < 10 ? $month = $date->month() : $month = "0" . $date->month(); say $month'
08
@reneeb
reneeb / Insomnia.json
Created Jun 4, 2021
Requests for OTOBO
View Insomnia.json
{"_type":"export","__export_format":4,"__export_date":"2021-06-04T08:06:12.222Z","__export_source":"insomnia.desktop.app:v2021.2.2","resources":[{"_id":"req_e0440f2249924925a559926ad23352d5","parentId":"fld_77985ae5fa7d4d9a96fb4695beb0ce2c","modified":1622793939326,"created":1622793939326,"url":"http://192.168.123.122/otobo/nph-genericinterface.pl/Webservice/Tickets/Ticket","name":"TicketCreate","description":"","method":"POST","body":{"mimeType":"application/json","text":"{\n\t\"UserLogin\": \"ta\",\n\t\"Password\": \"ta\",\n\t\"Ticket\" : {\n\t\t\"Queue\": \"Raw\",\n\t\t\"PriorityID\": 3,\n\t\t\"Title\": \"Test\",\n\t\t\"State\": \"open\",\n\t\t\"CustomerUser\": \"tc\"\n\t},\n\t\"Article\": {\n\t\t\"Subject\": \"Article for Test Ticket\",\n\t\t\"From\": \"test@test.de\",\n\t\t\"IsVisibleForCustomer\": 1,\n\t\t\"ContentType\": \"text/plain; charset=utf-8\",\n\t\t\"Body\": \"Wir haben ein Problem Houston!\",\n\t\t\"CommunicationChannelID\": 1,\n\t\t\"To\": \"agent@test.tld\"\n\t}\n}"},"parameters":[],"headers
@reneeb
reneeb / CheckNavigationBarModules.pl
Created Jun 2, 2021
Check if all navigation bar modules can be loaded
View CheckNavigationBarModules.pl
#!/usr/bin/perl
use strict;
use warnings;
use lib qw(/opt/otrs);
use Kernel::System::ObjectManager;
local $Kernel::OM = Kernel::System::ObjectManager->new;
View open_api_client.pl
#!/usr/bin/perl
use strict;
use warnings;
use Mojo::Loader qw(data_section);
use OpenAPI::Client;
my $spec = data_section 'main', 'swagger.json';
my $client = OpenAPI::Client->new( $spec );
View upgrade.pl
#!/usr/bin/perl
use v5.10;
use strict;
use warnings;
use Data::Dumper;
use LWP::Simple;
use File::Spec;
View Test
https://files.perl-academy.de/CE94F212-1668-11EA-8388-93A3F28714BF
View SetQV - Installation
* SetQV.pm nach /opt/otrs/Kernel/System/Ticket/Event/SetQV.pm kopieren
* SetQV.xml nach /opt/otrs/Kernel/Config/Files/XML/SetQV.xml kopieren
* Als OTRS-User auf der Kommandozeile `perl bin/otrs.Console.pl Maint::Config::Rebuild` ausführen
View bashrc
function enmod() {
cd /opt/otrs
perl -I/opt/otrs/Kernel/cpan-lib -I/opt/otrs -I/home/otrsvm/module-tools/lib /home/otrsvm/module-tools/bin/otrs.ModuleTools.pl Module::Package::Install /home/otrsvm/OTRS/$1 /opt/otrs --verbose
perl bin/otrs.Console.pl Maint::Config::Rebuild
}
function dismod() {
cd /opt/otrs
perl -I/opt/otrs/Kernel/cpan-lib -I/opt/otrs -I/home/otrsvm/modules-tools/lib /home/otrsvm/module-tools/bin/otrs.ModuleTools.pl Module::Package::Uninstall /home/otrsvm/OTRS/$1 /opt/otrs --verbose
perl bin/otrs.Console.pl Maint::Config::Rebuild
View AgentTicketCompose.tt
[% WRAPPER JSOnDocumentComplete %]
<script type="javascript">//<![CDATA[
var ID = $('input[name="ResponseID"]').val();
console.debug( "ResponseID: " + ID );
if ( ID == 2 ) {
$('#StateID').val(6).trigger('redraw.InputField');
}
//]]></script>
[% END %]
View gist:65cd1202ada86633a7f3f19e8e3953b5
perl -MPath::Tiny=path -E 'my $this = path(".")->absolute; for my $path ( $this->children ) { next if $path->is_file; chdir $path->stringify; say "$path"; say qx{git status}; chdir $this->stringify }'