Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

# see: https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html
LOGLEVELS = %w[DEBUG INFO WARN ERROR FATAL UNKNOWN].freeze
LOGGER = Logger.new(STDOUT)
level ||= LOGLEVELS.index ENV.fetch("LOG_LEVEL","WARN") # default to WARN index: 2
level ||= Logger::WARN # FIX default in case of environment LOG_LEVEL value is present but not correct
LOGGER.level = level
# Usage:
# before launching the program:
# $ export LOG_LEVEL=DEBUG
# Copyright (C) 2022 Franco Rondini and Contributors
# Licence MIT
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
@rondinif
rondinif / gist:b53db332cbcb559afa5b0b36b01874f2
Created February 14, 2020 07:13
copy dotfiles from home
~ $ ruby -rfileutils -e 'Dir[".*"].each {|x| FileUtils.copy(x,"./dotfiles") if File.file?x}'
~ $ ls -la dotfiles/ | sort -k9,9
total 82464
drwxr-xr-x 55 <user> staff 1760 Feb 14 08:04 .
drwxr-xr-x@ 230 <user> staff 7360 Feb 14 08:01 ..
-r-------- 1 <user> staff 7 Feb 14 08:04 .CFUserTextEncoding
-rw-r--r-- 1 <user> staff 45060 Feb 14 08:04 .DS_Store
-rw------- 1 <user> staff 228 Feb 14 08:04 .Xauthority
-rw-r--r-- 1 <user> staff 0 Feb 14 08:04 .aesh_aliases
-rw-r--r-- 1 <user> staff 41797443 Feb 14 08:04 .babel.json
@rondinif
rondinif / podman-registries-configuration
Created October 22, 2019 07:35
inspect podman registries configuration
[user@linux ~]$ grep -Inr registries /etc/containers/registries.conf
1:# For more information on this configuration file, see containers-registries.conf(5).
11:[registries.search]
12:registries = ['docker.io', 'registry.fedoraproject.org', 'quay.io', 'registry.access.redhat.com', 'registry.centos.org']
16:[registries.insecure]
17:registries = []
20:# "*", then the docker daemon will only be allowed to pull from registries listed above in the search
21:# registries. Blocked Registries is deprecated because other container runtimes and tools will not use it.
23:# registries you want to allow users to pull and push from. policy.json gives greater flexibility, and
26:[registries.block]
@rondinif
rondinif / api.github.com-graphql
Created October 12, 2019 17:59
get the text of all the README.md on the master branch of my own repositories on github ( with syntax comparison between api.github.com.graphql and gatsby http://localhost:8000/___graphql?query= )
query {
viewer {
repositories(first: 100, privacy: PUBLIC, ownerAffiliations: OWNER, isFork: false) {
edges {
node {
name
readme: object(expression: "master:README.md") {
... on Blob {
text
}
@rondinif
rondinif / api.github.com-graphql
Created October 12, 2019 17:59
get the text of all the README.md on the master branch of my own repositories on github ( with syntax comparison between api.github.com.graphql and gatsby http://localhost:8000/___graphql?query= )
query {
viewer {
repositories(first: 100, privacy: PUBLIC, ownerAffiliations: OWNER, isFork: false) {
edges {
node {
name
readme: object(expression: "master:README.md") {
... on Blob {
text
}
@rondinif
rondinif / upgrade-package-management.sh
Last active August 7, 2019 16:53
OSX update and upgrade package management : home-brew, rubygem, npm and so on
#!/bin/bash -
#title :upgrade-package-management.sh
#description :update and upgrade various package management and installed packages
#author :Franco Rondini
#date :20181223
#version :0.1-ALPHA-DO-NOT-USE-AS-IS-IN-PRODUCTION
#usage: comment out the package management that are not of your iterest and/or add the missing ones then launch the script in bash
#credits:
# - with reference to:
# - https://forum.shakacode.com/t/when-to-brew-update-and-brew-upgrade/350/3
@rondinif
rondinif / PhytoJS-documentation.json
Created July 27, 2019 14:49
PhytoJS documentation
[
{
"description": {
"type": "root",
"children": [
{
"type": "paragraph",
"children": [
{
"type": "text",
@rondinif
rondinif / check-java12-env
Created April 14, 2019 11:30
command line setup of [ openjdk version "12" ] on [ Mac OS X 10.14.3 ]
$ java -XshowSettings -version
Picked up JAVA_TOOL_OPTIONS: -Duser.country=US -Duser.language=en
VM settings:
Max. Heap Size (Estimated): 4.00G
Using VM: OpenJDK 64-Bit Server VM
Property settings:
awt.toolkit = sun.lwawt.macosx.LWCToolkit
file.encoding = UTF-8
file.separator = /
@rondinif
rondinif / command-line-slim-setup-osx-10_13_6-high-sierra.md
Last active October 14, 2018 01:16
Install Slim Framework with the Composer dependency manager on native macOS.