Skip to content

Instantly share code, notes, and snippets.

@bzerangue
bzerangue / _verify-repair-permissions-disk.md
Last active September 23, 2023 20:00
Mac OS X Utilities via Terminal: (Verify and Repair: Disk Permissions AND Disk / Software Update / TimeMachine)
View _verify-repair-permissions-disk.md
@bzerangue
bzerangue / rfc-date-to-iso-date.xsl
Created March 9, 2011 16:11
[XSLT] Convert RFC 2822 format to ISO date format
View rfc-date-to-iso-date.xsl
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Name: RSS feed date format to Symphony date format
Version: 1.0
Author: Brian Zerangue <brian.zerangue@gmail.com>
URL: http://symphony21.com/downloads/xslt/file/20457/
Description:
Convert RSS feed date format to Symphony date format
Convert RFC 2822 timestamp format to ISO date format minus the time info (Symphony CMS date format)
@bzerangue
bzerangue / home-assistant-x86-install.md
Last active August 29, 2023 14:30
Using Live Image of ZorinOS/Ubuntu/Linux Mint to Create Home Assistant OS boot drive - for x86 machines
View home-assistant-x86-install.md

Installing the official Home Assistant OS on an old x86 PC.

This is not a support document. Not responsible for whomever might use this. This put down for my personal use and if anyone else wants to use it they can, but this process will remove any data from the target device they are installing on.

REQUIREMENTS:

  • Intel or AMD x86 PC, monitor, keyboard, internet connection via ethernet.
  • Bootable USB thumb drive of the latest dekstop version of ZorinOS, Ubuntu, or Linux Mint
  1. Boot your machine with the bootable Zorin OS and select Try Zorin OS (you do NOT want to install it)
@bzerangue
bzerangue / html2md-with-pandoc.sh
Created April 26, 2012 23:14
RECURSIVELY Bash convert all your html to markdown files (with Pandoc)
View html2md-with-pandoc.sh
find . -name "*.ht*" | while read i; do pandoc -f html -t markdown "$i" -o "${i%.*}.md"; done
@bzerangue
bzerangue / json-to-ndjson.md
Last active August 23, 2023 11:42
JSON to NDJSON
View json-to-ndjson.md

NDJSON is a convenient format for storing or streaming structured data that may be processed one record at a time.

  • Each line is a valid JSON value
  • Line separator is ‘\n’

1. Convert JSON to NDJSON?

cat test.json | jq -c '.[]' > testNDJSON.json
@bzerangue
bzerangue / recursively-rename-extension.sh
Created April 16, 2012 00:31
Terminal Script: Recursively rename or change file extensions (this example, changing extension from .html to .php)
View recursively-rename-extension.sh
find . -name "*.html" | while read i; do mv "$i" "${i%.html}.php"; done
@bzerangue
bzerangue / array2xml.php
Last active June 28, 2023 04:29
Decoding JSON to a PHP Array and then converting it to XML.
View array2xml.php
<?php
/**
* Array2XML: A class to convert array in PHP to XML
* It also takes into account attributes names unlike SimpleXML in PHP
* It returns the XML in form of DOMDocument class for further manipulation.
* It throws exception if the tag name or attribute name has illegal chars.
*
* Author : Lalit Patel
* Website: http://www.lalit.org/lab/convert-php-array-to-xml-with-attributes
* License: Apache License 2.0
@bzerangue
bzerangue / transform.php
Created March 22, 2012 21:42
PHP: XSLT Transformation
View transform.php
<?php
// You instantiating the XSLTProcessor - libXSLT
$xmlProc = new XsltProcessor();
// Your XSLT Stylesheet for transforming XML
$xslt = new DomDocument();
$xslt -> load("example.xsl");
// This prepares the XSLT for transform
$xmlProc -> importStylesheet($xslt);
@bzerangue
bzerangue / states-provinces-selectbox.html
Created July 10, 2012 15:13
A form selectbox with US States/Territories and Canadian Provinces
View states-provinces-selectbox.html
<select id="state" name="state">
<option value="">Select One</option>
<optgroup label="U.S. States/Territories">
<option value="AK">Alaska</option>
<option value="AL">Alabama</option>
<option value="AR">Arkansas</option>
<option value="AZ">Arizona</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
@bzerangue
bzerangue / yahoo-weather-condition-codes.xml
Created February 1, 2011 06:53
Yahoo Weather Condition Codes
View yahoo-weather-condition-codes.xml
<?xml version="1.0" encoding="UTF-8"?>
<yahoo-weather-codes>
<code number="0" description="tornado"/>
<code number="1" description="tropical storm"/>
<code number="2" description="hurricane"/>
<code number="3" description="severe thunderstorms"/>
<code number="4" description="thunderstorms"/>
<code number="5" description="mixed rain and snow"/>
<code number="6" description="mixed rain and sleet"/>
<code number="7" description="mixed snow and sleet"/>