Skip to content

Instantly share code, notes, and snippets.

@carlosedp
carlosedp / main.yml
Created Jan 28, 2019
Ansible playbook to automate new Kubernetes SBC nodes
View main.yml
---
- name: Setup SBC
hosts: all
#become: true
#become_user: root
gather_facts: false
vars:
#New user to be created
new_user: newuser
@abhinavjain241
abhinavjain241 / DownloadMusic.sh
Last active Mar 31, 2021
[Shell Script] Download Music from YouTube using youtube-dl and use MusicBrainz Picard to correct Metadata
View DownloadMusic.sh
#!/bin/bash
#The script downloads the song from YouTube using youtube-dl command line utitlity. After that it calls MusicBrainz Picard (MP3 ID3 Tagger) to correct the metadata. Post that, it calls mp3info to display the ID3 tag information as well as prompts the user whether they want to play the song.
if test "$#" -lt 1; then
echo "Illegal number of parameters"
echo "Usage: dl-music [URL] [OPTIONS]"
exit
fi
if [[ "$2" == '1' ]]
@techniq
techniq / README.md
Last active Nov 26, 2020
Convert JSON boolean strings ("true"/"false") to boolean values
View README.md

Convert undefined to false

JSON.parse(someVariable || false)

Returns

  • "true" => true
  • "false" => false
  • undefined => false
View import_json_appsscript.js
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@brablc
brablc / postfix_grok_pattern
Last active Sep 27, 2020
Logstash example configuration for parsing Postfix mail log files
View postfix_grok_pattern
# Postfix stuff based on https://gist.github.com/jbrownsc/4694374:
QUEUEID (?:[A-F0-9]+|NOQUEUE)
EMAILADDRESSPART [a-zA-Z0-9_.+-=:]+
EMAILADDRESS %{EMAILADDRESSPART:local}@%{EMAILADDRESSPART:remote}
RELAY (?:%{HOSTNAME:relayhost}(?:\[%{IP:relayip}\](?::[0-9]+(.[0-9]+)?)?)?)
POSREAL [0-9]+(.[0-9]+)?
DELAYS (%{POSREAL}[/]*)+
DSN %{NONNEGINT}.%{NONNEGINT}.%{NONNEGINT}
STATUS sent|deferred|bounced|expired