Skip to content

Instantly share code, notes, and snippets.

@bzerangue
bzerangue / recursive-chmod.md
Last active Nov 22, 2022
Scripts for recursively chmod directories only and recursively chmod files only
View recursive-chmod.md

Useful commands

You may find these commands useful when adjusting file and directory permissions.

To recursively chmod directories only:

find /your/site/root -type d -exec chmod 755 {} \;

To recursively chmod files only:

@bzerangue
bzerangue / _verify-repair-permissions-disk.md
Last active Nov 19, 2022
Mac OS X Utilities via Terminal: (Verify and Repair: Disk Permissions AND Disk / Software Update / TimeMachine)
View _verify-repair-permissions-disk.md

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

Verify Permissions

diskutil verifyPermissions /

Repair Permissions

diskutil repairPermissions /

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 / html2md-with-pandoc.sh
Created Apr 26, 2012
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 / sermons.rss.xml.twig
Last active Oct 21, 2022
Twig Example template for RSS feed
View sermons.rss.xml.twig
<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
<channel>
<title>Sermons at Irving Bible Church</title>
<!-- Need to update with appropriate Sermon RSS Feed location -->
<atom:link href="http://irvingbible.org/sermons/rss.xml" rel="self" type="application/rss+xml"></atom:link>
<link>http://www.irvingbible.org/sermons/</link>
<description>Weekly morning sermons from Irving Bible Church in Irving, TX. For all of our sermon archives, please visit http://www.irvingbible.org/sermons.</description>
<lastBuildDate>Tue, 01 Dec 2015 00:00:00 -0600</lastBuildDate>
<language>en-us</language>
@bzerangue
bzerangue / debian-home-assistant-supervised_instructions.md
Last active Oct 18, 2022
Installing Debian + Home Assistant Supervised
View debian-home-assistant-supervised_instructions.md

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
bzerangue / recursively-rename-extension.sh
Created Apr 16, 2012
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 / master.xsl
Created Nov 15, 2010
HTML5 Boilerplate XSLT Master Stylesheet, see html5boilerplate.com
View master.xsl
<?xml version="1.0" encoding="UTF-8" ?>
<!--
HTML5 Boilerplate XSLT Master Stylesheet (based on Paul Irish's HTML5 Boilerplate index.html file)
Created by Brian Zerangue on 2010-11-15.
Copyright (c) 2010 Paul Irish (Everything but the XSLT), Brian Zerangue (XSLT).
HTML5 Boilerplate, http://html5boilerplate.com
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
@bzerangue
bzerangue / array2xml.php
Last active Sep 14, 2022
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 / html-page-print-test.html
Last active Aug 19, 2022
nameTagContainer - MP NameTag - TEST for Secure NameTag
View html-page-print-test.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Document</title>
</head>
<body>
<div id="nameTagContainer" style="font-family:'Geneva','sans-serif';height:173px;width:272px;">