Skip to content

Instantly share code, notes, and snippets.

@carlosedp
carlosedp / main.yml
Created January 28, 2019 19:02
Ansible playbook to automate new Kubernetes SBC nodes
---
- 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 March 31, 2021 18:14
[Shell Script] Download Music from YouTube using youtube-dl and use MusicBrainz Picard to correct Metadata
#!/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 November 26, 2020 15:32
Convert JSON boolean strings ("true"/"false") to boolean values

Convert undefined to false

JSON.parse(someVariable || false)

Returns

  • "true" => true
  • "false" => false
  • undefined => false
/**
* 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 September 27, 2020 20:10
Logstash example configuration for parsing Postfix mail log files
# 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