Skip to content

Instantly share code, notes, and snippets.

Avatar

Jason Maurer jaysn

View GitHub Profile
@jaysn
jaysn / cron.save-vms.sh
Last active Oct 9, 2019
basic Cron Bash Script to automatically save specific VirtualBox VMs using savestate, copy, tar and p7zip
View cron.save-vms.sh
#!/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 Apr 9, 2017
Reisen Udongein html table
View Udongein.html
<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 Aug 29, 2015
Funktion zur Bildung eines Skalarproduktes von 2 Vektoren (dargestellt als Arrays)
View skalarprodukt.php
<?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 Sep 1, 2011
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
View Array att_array_combine(array &default_pairs, $atts)
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;