Skip to content

Instantly share code, notes, and snippets.

bzerangue /
Last active March 22, 2023 13:00

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 /
Last active March 19, 2023 15:37
Mac OS X Utilities via Terminal: (Verify and Repair: Disk Permissions AND Disk / Software Update / TimeMachine)

Verify and Repair Disk Permissions via Terminal (Mac OS X)

Verify Permissions

diskutil verifyPermissions /

Repair Permissions

diskutil repairPermissions /

bzerangue / canada-provinces.xml
Created May 21, 2011 19:32
Canada Provinces
View canada-provinces.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- Canada provinces -->
<provinces country="Canada">
<province name="Alberta" french-name="Alberta" abbreviation="AB" capital="Edmonton" founded="1905" time-zone-1="MST (UTC-07)"/>
<province name="British Columbia" french-name="Colombie-Britannique" abbreviation="BC" capital="Victoria" founded="1871" time-zone-1="PST (UTC-08)" time-zone-2="MST (UTC-07)"/>
<province name="Manitoba" french-name="Manitoba" abbreviation="MB" capital="Winnipeg" founded="1870" time-zone-1="CST (UTC-06)"/>
<province name="New Brunswick" french-name="Nouveau-Brunswick" abbreviation="NB" capital="Fredericton" founded="1867" time-zone-1="AST (UTC-04)"/>
<province name="Newfoundland and Labrador" french-name="Terre-Neuve-et-Labrador" abbreviation="NL" capital="St. John's" founded="1949" time-zone-1="AST (UTC-04)" time-zone-2="NST (UTC-03:30)"/>
<province name="Northwest Territories" french-name="Territoires du Nord-Ouest" abbreviation="NT" capital="Yellowkn
bzerangue / us-states.xml
Created May 21, 2011 20:54
List of States in the United States of America (with dates of when they became as state)
View us-states.xml
<?xml version="1.0" encoding="UTF-8"?>
<states nation="United States of America" nation-abbreviation="USA" nation-capital="Washington, D.C.">
<state name="Alabama" abbreviation="AL" capital="Montgomery" date="1819-12-14" most-populous-city="Birmingham" population="4708708" square-miles="52423" time-zone-1="CST (UTC-06)" time-zone-2="EST (UTC-05)" dst="Yes"/>
<state name="Alaska" abbreviation="AK" capital="Juneau" date="1959-01-03" most-populous-city="Anchorage" population="698473" square-miles="656425" time-zone-1="AKST (UTC-09)" time-zone-2="HST (UTC-10)" dst="Yes"/>
<state name="Arizona" abbreviation="AZ" capital="Phoenix" date="1912-02-14" most-populous-city="Phoenix" population="6595778" square-miles="114006" time-zone-1="MT (UTC-07)" dst="No"/>
<state name="Arkansas" abbreviation="AR" capital="Little Rock" date="1836-06-15" most-populous-city="Little Rock" population="2889450" square-miles="53182" time-zone-1="CST (UTC-06)" dst="Yes"/>
<state name="California" abbreviation="CA" capital="Sacrame
bzerangue /
Created April 26, 2012 23:14
RECURSIVELY Bash convert all your html to markdown files (with Pandoc)
find . -name "*.ht*" | while read i; do pandoc -f html -t markdown "$i" -o "${i%.*}.md"; done
bzerangue /
Last active January 19, 2023 16:10
Binding and Unbinding to Active Directory from Mac OS via Command Line

Binding and Unbinding to Active Directory from Mac OS via Command Line

  • Open the Terminal Application
  • Type in sudo -i and type in your Mac Administrator account password. sudo gives you root level or administrator level privileges.

To View current Active Directory Settings

dsconfigad -show

To Unbind a Computer from an Active Directory Domain

bzerangue / array2xml.php
Last active January 17, 2023 16:07
Decoding JSON to a PHP Array and then converting it to XML.
View array2xml.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:
* License: Apache License 2.0
bzerangue /
Created April 16, 2012 00:31
Terminal Script: Recursively rename or change file extensions (this example, changing extension from .html to .php)
find . -name "*.html" | while read i; do mv "$i" "${i%.html}.php"; done
bzerangue /
Last active December 20, 2022 20:21
Installing Debian + Home Assistant Supervised

Installing Debian + Home Assistant Supervised (for a linux 64 bit pc intel or amd)

Build a USB installer for Debian (non-free firmware), download the Debian Buster and build usb installer with Balena Etcher

In the Debian installer, uncheck Debian desktop environment and check ssh server and other software modules.

After installing Debian, reboot the machine and login via ssh with the username you created during setup...

Once you have SSH'd from the terminal and have logged into your new Debian machine, run the following command...

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>