Skip to content

Instantly share code, notes, and snippets.

@pmoranga
pmoranga / Checking your Raspberry Pi's view of its power supply.md
Created August 16, 2023 22:44 — forked from Paraphraser/Checking your Raspberry Pi's view of its power supply.md
Checking your Raspberry Pi's view of its power supply (sometimes it's not the wall-wart)

Checking your Raspberry Pi's view of its power supply

Sometimes it seems like the first (and sometimes only) advice you get offered for almost any problem with a Raspberry Pi is "check your power supply". You think something like:

"hey, I'm using an official power supply sold as being matched with my Pi so how can there be any problem?"

You look up the specs then stick a controlled load across your supply and confirm that it can deliver the required number of Watts.

Yet your problems persist…

@pmoranga
pmoranga / MongoDB3-group-by-timestamp.js
Created February 21, 2023 15:59
On a mongo 3.6, group items by month from field with timestamp value
db.getCollection('Flights').aggregate([
{ $match: {"airport_code" : "AMS"}}
,{"$group": {"_id":
{ $dateToString: {
date: {"$add": [new Date(0),
{"$multiply": ["$created_at",1000 ]}
] } ,
format: "%Y-%m"}
}
, "count": {"$sum": 1}}}
@pmoranga
pmoranga / 01-pre-install.sh
Created July 8, 2022 21:17 — forked from xenophonf/01-pre-install.sh
K3s on Ubuntu 20.04 with root on encrypted ZFS
#!/bin/sh
# Run as user `ubuntu` from the Ubuntu Desktop installer's live environment.
sudo apt-add-repository universe
sudo apt update
passwd ubuntu
sudo apt install --yes openssh-server screen vim
ip addr show scope global | grep inet
@pmoranga
pmoranga / .pre-commit-config.yaml
Last active February 28, 2024 11:14 — forked from skwashd/pre-commit
Git pre-commit hook that blocks commits for files that contain swear words.
## Example using https://pre-commit.com/
repos:
- repo: local
hooks:
- id: dontship
name: DONTSHIP check - Block words
entry: '\bdie\b'
language: pygrep # https://pre-commit.com/#pygrep
types: [php]
@pmoranga
pmoranga / traefik_deployment.yaml
Created May 3, 2021 21:40 — forked from guyromb/traefik_deployment.yaml
Traefik - Streaming Access Logs with JWT decoder using Filebeat
apiVersion: apps/v1
kind: Deployment
spec:
template:
metadata:
annotations:
co.elastic.logs/enabled: "true"
co.elastic.logs/processors.0.decode_json_fields.fields: message
co.elastic.logs/processors.0.decode_json_fields.target: ""
co.elastic.logs/processors.1.dissect.field: request_Authorization
kubectl get nodes -o custom-columns='NAME:.metadata.name,InternalIP:.status.addresses[?(@.type=="InternalIP")].address'
@pmoranga
pmoranga / 00_readme.md
Created August 13, 2020 07:28 — forked from metacoma/00_readme.md
ArgoCD & Kapitan configuration

Using ArgoCD together with Kapitan is actually pretty easy and only requires the kapitan binary in the argo-repo-server and a ConfigManagement plugin in ArgocD (https://argoproj.github.io/argo-cd/user-guide/config-management-plugins/)

1. Edit argocd-cm configmap and add :

  configManagementPlugins: |
    - name: kapitan
      init:
        command: [sh]
        args: ["kapitan-base-compile.sh"]
@pmoranga
pmoranga / 00_readme.md
Created August 12, 2020 17:55 — forked from skinny/00_readme.md
ArgoCD & Kapitan configuration

Using ArgoCD together with Kapitan is actually pretty easy and only requires the kapitan binary in the argo-repo-server and a ConfigManagement plugin in ArgocD (https://argoproj.github.io/argo-cd/user-guide/config-management-plugins/)

1. Edit argocd-cm configmap and add :

  configManagementPlugins: |
    - name: kapitan
      init:
        command: [sh]
        args: ["kapitan-base-compile.sh"]
@pmoranga
pmoranga / datadog-snmp-synology.yaml
Created May 25, 2020 07:44
Datadog SNMP configuration to collect Synology statistics. Should be put into `conf.d` folder. SNMP User should be created / enabled on Synology (RO access)
init_config:
mibs_folder: /mibs
profiles:
generic:
definition_file: _generic-host-resources.yaml
instances:
- ip_address: $REPLACE_WITH_SYNOLOGY_IP_ADDRESS
community_string: public
snmp_version: 2
@pmoranga
pmoranga / datadog-snmp-synology.yaml
Created May 25, 2020 07:42
Datadog SNMP configuration to collect Synology statistics.
init_config:
mibs_folder: /mibs
profiles:
generic:
definition_file: _generic-host-resources.yaml
instances:
- ip_address: $REPLACE_WITH_SYNOLOGY_IP_ADDRESS
community_string: public
snmp_version: 2