Skip to content

Instantly share code, notes, and snippets.

View jaysn's full-sized avatar

Jason Maurer jaysn

  • Dinslaken, NRW, Germany
View GitHub Profile
@jaysn
jaysn / cron.save-vms.sh
Last active October 9, 2019 14:07
basic Cron Bash Script to automatically save specific VirtualBox VMs using savestate, copy, tar and p7zip
#!/bin/bash
# Vars
# BUDATE - our date used for the Backup-Folder name which is created in our Backup-Path
# VBOXUSER - used if your VirtualBox is started and managed by a special/specific user
# BACKUPMNT - the mountpoint of your Backup-Media/HDD/SSD/whatever
# VMPATH - Path to your VirtualBox VMs Folder
# BUPATH - complete Path to your Backup-Folder - where date-based folders are created for each (Daily-)Backup
# VMLIST - List of VMs (Names only) to backup - passed to vboxmanage and used for the Copy-Part so please use names only..
@jaysn
jaysn / Udongein.html
Created April 9, 2017 11:37
Reisen Udongein html table
<html>
<body bgcolor=000000>
<table boder=0 cellpadding=0 cellspacing=0>
<tr height=3>
<td width=3 bgcolor=888888 rowspan=105></td>
<td bgcolor=888888 colspan=54></td>
<td width=3 bgcolor=888888 rowspan=105></td>
</tr>
@jaysn
jaysn / skalarprodukt.php
Last active August 29, 2015 14:17
Funktion zur Bildung eines Skalarproduktes von 2 Vektoren (dargestellt als Arrays)
<?php
/** anpassen unterschiedlich dimensionierter vektoren/arrays **/
function vektor_anpassung_ref( &$aV1, &$aV2 ) {
$nLim1 = count( $aV1 );
$nLim2 = count( $aV2 );
if( $nLim1 > $nLim2 ) {
// |v1| > |v2| - erweitere v2 mit null-werten zur dimension von v1
$aV2 = array_pad( $aV2, $nLim1, 0 );
return $nLim1;
}
@jaysn
jaysn / Array att_array_combine(array &default_pairs, $atts)
Created September 1, 2011 09:01
returns a standartized array following the scheme of $defaul_pairs(accepted_field => default_value) inserting the values of $atts if the field exists in $default_pairs
function att_array_combine($default_pairs, $atts) {
$atts = (array)$atts;
$combined = array();
foreach($default_pairs as $name => $default) {
if ( array_key_exists($name, $atts) )
$combined[$name] = $atts[$name];
else
$combined[$name] = $default;
}
return $combined;