Skip to content

Instantly share code, notes, and snippets.

<?php
/* A modified version of the monitoring script described in the article at
https://medium.com/winkhosting/server-monitoring-with-php-and-bash-scripts-c078616a6e2f
For demonstration purposes only
Since the monitor script does not send files, the script is written
to handle the POST request via routes
*/
#!/usr/bin/env bash
# A modified version of the monitoring script described in the article
# at https://medium.com/winkhosting/server-monitoring-with-php-and-bash-scripts-c078616a6e2f
#
# For demonstration purposes only
#
# The main idea is to avoid temporary files
# Timers (in seconds)
@pmeszaros
pmeszaros / json2csv.sh
Created June 24, 2020 06:44
Convert JSON to CSV with JQ
#!/bin/bash
FILE=$1
jq -r '(map(keys) | add | unique) as $cols | map(. as $row | $cols | map($row[.])) as $rows | $cols, $rows[] | @csv'
######################################################################
# Basic console stuff #
######################################################################
brew 'git'
brew 'git-extras'
brew 'ncdu'
brew 'tree'
brew 'nnn'
@pmeszaros
pmeszaros / docker-compose.yaml
Created November 8, 2017 19:50
docker-compose.yaml for Slim Framework Skeleton with MySQL and phpMyAdmin
version: '2'
volumes:
logs:
driver: local
services:
mysql:
image: mysql:5.7
volumes:
@pmeszaros
pmeszaros / csv2yaml.rb
Last active October 30, 2017 18:29
Simple conversion from csv to yaml in Ruby. As separator is used semicolon. Usage: ruby csv2yaml.rb source.csv > output.yaml
require 'csv'
require 'yaml'
filename = ARGV[0]
csv = CSV.read(filename, :headers => true, :col_sep => ';').map(&:to_hash)
puts csv.to_yaml
@pmeszaros
pmeszaros / rpi_timezone.yml
Created March 2, 2016 10:15
Raspberry PI Ansible playbook for timezone setting
---
- name: Set Time Zone
hosts: local
remote_user: pi
become: yes
become_method: sudo
gather_facts: false
vars:
- timezone: 'Europe/Bratislava'
tasks: