Skip to content

Instantly share code, notes, and snippets.

@gfjardim
gfjardim / xmltocmd
Last active March 2, 2016 20:22
Translate unRAID templates to Docker Run commands
#!/usr/bin/php
<?PHP
function xmlToCommand($xmlFile){
global $var;
$doc = new DOMDocument();
$doc->loadXML($xmlFile);
$Name = $doc->getElementsByTagName( "Name" )->item(0)->nodeValue;
$cmdName = (strlen($Name)) ? '--name="' . $Name . '"' : "";
$Privileged = $doc->getElementsByTagName( "Privileged" )->item(0)->nodeValue;
#!/usr/bin/env python3
import re, sys, os, json, datetime, urllib.request, unicodedata, pprint
from pyriscope.__main__ import main
from bs4 import BeautifulSoup
def unique(items):
found = set([])
keep = []
for item in items:
if item not in found:
function listDir($root) {
$iter = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($root,
RecursiveDirectoryIterator::SKIP_DOTS),
RecursiveIteratorIterator::SELF_FIRST,
RecursiveIteratorIterator::CATCH_GET_CHILD);
$paths = array();
foreach ($iter as $path => $fileinfo) {
if (! $fileinfo->isDir()) $paths[] = $path;
}
function listDir($root, $filter=null) {
$iter = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($root,
RecursiveDirectoryIterator::SKIP_DOTS),
RecursiveIteratorIterator::SELF_FIRST,
RecursiveIteratorIterator::CATCH_GET_CHILD);
$paths = array();
foreach ($iter as $path => $fileinfo) {
if ($filter && is_bool(strpos($path, $filter))) continue;
if (! $fileinfo->isDir()) $paths[] = $path;
$plugin = "unassigned.devices";
$paths = array("smb_extra" => "/boot/config/smb-extra.conf",
"smb_usb_shares" => "/etc/samba/unassigned-shares",
"usb_mountpoint" => "/mnt/disks",
"log" => "/var/log/{$plugin}.log",
"config_file" => "/boot/config/plugins/{$plugin}/{$plugin}.cfg",
"state" => "/var/state/${plugin}.ini",
"samba_mount" => "/boot/config/plugins/${plugin}/samba_mount.cfg"
);
@gfjardim
gfjardim / build.sh
Last active October 22, 2023 13:07
Build script for unRAID 6
#!/bin/bash
D="$(dirname "$(readlink -f ${BASH_SOURCE[0]})")"
BZROOT="/boot/bzroot"
URLS="
http://mirrors.slackware.com/slackware/slackware64-14.1/slackware64/d/gcc-4.8.2-x86_64-1.txz
http://mirrors.slackware.com/slackware/slackware64-14.1/slackware64/d/gcc-g++-4.8.2-x86_64-1.txz
http://mirrors.slackware.com/slackware/slackware64-14.1/patches/packages/glibc-2.17-x86_64-10_slack14.1.txz
http://mirrors.slackware.com/slackware/slackware64-14.1/slackware64/d/binutils-2.23.52.0.1-x86_64-2.txz