Skip to content

Instantly share code, notes, and snippets.

View leodido's full-sized avatar
🌀

Leo Di Donato leodido

🌀
View GitHub Profile
### Keybase proof
I hereby claim:
* I am leodido on github.
* I am leodido (https://keybase.io/leodido) on keybase.
* I have a public key whose fingerprint is 6FB3 CD09 5FA1 CF66 8316 E159 BFFB 2449 0FD2 E91F
To claim this, I am signing this object:
Verifying that "leodido.id" is my Blockstack ID. https://onename.com/leodido
@leodido
leodido / how-to-download-all-jupyter-notebooks.md
Last active May 2, 2019 22:42
Create a TAR containing all the content of the jupiter server directory where this cell runs

How to

  1. Open your notebook
  2. Create a cell contain the python script
  3. Execute.

Get everything

  1. Open the root directory of your jupiter instance
  2. Create a new notebook
@leodido
leodido / syslog to influx.md
Last active November 18, 2024 19:35
Send docker syslogs to telegraf

Syslog to InfluxDB

docker => syslog (RFC5424, non-transparent) => telegraf => (*)

Docker can use syslog as a log driver.

Anyway it transport syslog message towards destination using the non-transparent framing technique (also if deprecated by the octet-counting).

Using the telegraf syslog input plugin link.

@leodido
leodido / go-syslog-rfc5424-besteffort.go
Last active March 5, 2019 00:26
Usage example of go-syslog to parse RFC5424 message with best effort mode on
package main
import (
"fmt"
"github.com/davecgh/go-spew/spew"
"github.com/influxdata/go-syslog/v2/rfc5424"
)
func main() {
@leodido
leodido / go-syslog-octet-couting-stream.go
Last active September 6, 2020 00:11
Usage example of go-syslog to parse a stream of syslog messages with octet-counting framing
package main
import (
"io"
"time"
"github.com/davecgh/go-spew/spew"
syslog "github.com/influxdata/go-syslog/v2"
"github.com/influxdata/go-syslog/v2/octetcounting"
)
@leodido
leodido / rsyslog.conf
Last active March 20, 2022 10:00
Rsyslog configuration to grab syslog messages from journald, convert them to RFC5424 syslog format and send them with octet-counting framing to a syslog receiver
# This only works with the following docker logging drivers currently: journald, json-file, and CRI-O log files
global(processInternalMessages="on")
global(parser.permitSlashInProgramName="on")
global(workDirectory="/var/spool/rsyslog") # default location for work (spool) files
# Raise limits within /etc/systemd/journald.conf on the host(s) - ie., RateLimitIntervalSec=30s + RateLimitBurst=1000000
module(load="imjournal" ignorepreviousmessages="on" ratelimit.interval="60" ratelimit.burst="2000000" persiststateinterval="10000" statefile="/var/spool/rsyslog/imjournal.state")
module(load="mmutf8fix")
module(load="mmkubernetes"
tls.cacert="/run/secrets/kubernetes.io/serviceaccount/ca.crt"
tokenfile="/run/secrets/kubernetes.io/serviceaccount/token"
function cache_uname {
what=$(uname -srm)
read -ra uname <<< "$what"
kern_name="${uname[0]}"
kern_vers="${uname[1]}"
mach_arch="${uname[2]}"
}
function get_os {
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@leodido
leodido / dumpstack.cpp
Created September 23, 2019 18:40
Dump the Lua stack
/*
* dump_stack(ls);
*/
void dump_stack(lua_State *L)
{
int i;
int top = lua_gettop(L);
printf("\n#### BOS ####\n");
for(i = top; i >= 1; i--)
{