Skip to content

Instantly share code, notes, and snippets.

View nokute78's full-sized avatar
🤔
I can contribute only on Saturday / Sunday...

Takahiro Yamashita nokute78

🤔
I can contribute only on Saturday / Sunday...
View GitHub Profile
@nokute78
nokute78 / sd_journal_open_directory_example.c
Created December 22, 2022 23:56
sd_journal_open_directory example
/* SPDX-License-Identifier: MIT-0 */
/* Based https://www.freedesktop.org/software/systemd/man/sd_journal_next.html */
#include <errno.h>
#include <stdio.h>
#include <systemd/sd-journal.h>
int main(int argc, char *argv[]) {
int r;
sd_journal *j;
@nokute78
nokute78 / arm_string.c
Created April 28, 2021 12:42
Fluent-bit issue 3142
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* Fluent Bit
* ==========
* Copyright (C) 2019-2021 The Fluent Bit Authors
* Copyright (C) 2015-2018 Treasure Data Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@nokute78
nokute78 / usecase_of_filter_lua.md
Last active January 20, 2022 01:02
The use case of lua_filter of fluent-bit

概要

https://fluentbit.io/

fluent-bit には Lua スクリプトでfilterできるプラグインがあります。 これを使うと、下記のようなことができます。

@nokute78
nokute78 / pe.go
Created August 8, 2019 11:23
Golang: pe optional header
package main
import (
"debug/pe"
"fmt"
"os"
)
func main() {
file, err := pe.Open(os.Args[1])
@nokute78
nokute78 / Execute-qemu-arm.md
Last active June 23, 2021 08:57
Testing QEMU (user mode emulation)

on ARM OS

$gcc --static helloworld.c -o helloworld

on Ubuntu 20.04 Host

sudo apt install g++-arm-linux-gnueabihf
sudo apt-get install qemu-system-arm
arm-linux-gnueabihf-gcc -Wall --static helloworld.c
@nokute78
nokute78 / hangup.c
Created February 8, 2017 12:23
out_flowcounter hang up
#include <unistd.h>
#include <fluent-bit.h>
int main()
{
int i;
int n;
char tmp[256];
flb_ctx_t *ctx;
int in_ffd;
@nokute78
nokute78 / hello_filter.c
Created February 6, 2017 13:44
in_lib: filter support
#include <unistd.h>
#include <fluent-bit.h>
int main()
{
int i;
int n;
char tmp[256];
flb_ctx_t *ctx;
int in_ffd;
@nokute78
nokute78 / filter.c
Created February 2, 2017 13:12
sample code for filter plugin
#include <unistd.h>
#include <fluent-bit.h>
#include <msgpack.h>
int my_stdout_json(void* data, size_t size)
{
printf("[%s]",__FUNCTION__);
printf("%s",(char*)data);
printf("\n");
@nokute78
nokute78 / doc.md
Created December 30, 2016 02:34
out_flowcounter_doc

out_flowcounter

The flowcounter output plugin, allows to count up records and its size.

Configuration Parameters

Key Description Default
Unit The unit of duration. (second/minute/hour/day) minute
@nokute78
nokute78 / compilation.txt
Created December 21, 2016 14:49
initializing at head of function or at some cases.
# OS
Raspbian on Raspberry Pi 2
# gcc
$ gcc --version
gcc (Debian 4.6.3-14+rpi1) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.