Skip to content

Instantly share code, notes, and snippets.

@NGenetzky
NGenetzky / README.md
Created September 12, 2022 06:06 — forked from RichardBronosky/README.md
Using cloud-init for cloudless provisioning of Raspberry Pi

Installing cloud-init on a fresh Raspbian Lite image

This is a work in Progress!

Purpose

This mainly demonstrates my goal of preparing a Raspberry Pi to be provisioned prior to its first boot. To do this I have chosen to use the same cloud-init that is the standard for provisioning servers at Amazon EC2, Microsoft Azure, OpenStack, etc.

I found this to be quite challenging because there is little information available for using cloud-init without a cloud. So, this project also servers as a demonstration for anyone on any version of Linux who may want to install from source, and/or use without a cloud. If you fall into that later group, you probably just want to read the code. It's bash so everything I do, you could also do at the command line. (Even the for loop.)

@NGenetzky
NGenetzky / README.md
Last active January 25, 2023 02:06 — forked from varemenos/1.README.md
Git log as JSON array

Git log as JSON array

git log \
  --pretty=format:'{^^^^date^^^^:^^^^%ci^^^^,^^^^abbreviated_commit^^^^:^^^^%h^^^^,^^^^subject^^^^:^^^^%s^^^^,^^^^body^^^^:^^^^%b^^^^}' \
  | sed 's/"/\\"/g' \
  | sed 's/\^^^^/"/g' \
  | jq -s '.'
@NGenetzky
NGenetzky / mac_info.py
Created December 2, 2018 18:24
Python Mac address vendor lookup
#!/usr/bin/env python
# References:
# [Python Mac address vendor lookup](https://macvendors.co/api/python)
# [@wichert](https://twitter.com/coding_wiggy)
import pprint
import requests
def mac_info(mac):
mac_url = 'http://macvendors.co/api/{0}'.format(mac)

Keybase proof

I hereby claim:

  • I am ngenetzky on github.
  • I am ngenetzky (https://keybase.io/ngenetzky) on keybase.
  • I have a public key ASDZ6wwBktlWsb9kTSq7FRNtEeYMrV0uWM5LkF9bGf3RcQo

To claim this, I am signing this object:

@NGenetzky
NGenetzky / env_to_tinydb.py
Created April 29, 2018 06:59
Dumps environment varaibles to a JSON file using TinyDB.
#!/usr/bin/env python
'''Dumps environment varaibles to a JSON file using TinyDB.
'''
import os
from tinydb import TinyDB
from tinydb import Query
DEFAULT_DB = './db.json'
#!/bin/bash
OPTIONS=''
# Options:
# -h | --help
# Print this message.
# -m | --machine
OPTIONS+=" --machine beaglebone"
# Build a machine supported by this layer.
# Default: build all machines supported by this layer.
@NGenetzky
NGenetzky / get_secrets.py
Last active January 6, 2018 19:10
Obtains secrets from secrets.json so they don't have to be in your code.
#!/usr/bin/env python
'''This reads data from a json file named "secrets.json"
Formated like this:
{
"trello": {
"api_key": "",
"token":"",
}
}
@NGenetzky
NGenetzky / 0_reuse_code.js
Last active January 5, 2017 20:17
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console