Skip to content

Instantly share code, notes, and snippets.

View dicagno's full-sized avatar

Alberto Di Cagno dicagno

View GitHub Profile
@dicagno
dicagno / Resample.hpp
Created June 7, 2022 04:13 — forked from pixelpusher/Resample.hpp
Downsampling example for C++
/**
* Resampling algo from http://en.wikipedia.org/wiki/Lanczos_resampling
* Adapted by / copyright Evan Raskob <[email protected]>, 2009-2019
* Free to use with attribution to all original authors / MIT License
* https://opensource.org/licenses/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.
@dicagno
dicagno / ANSI.md
Created January 22, 2022 09:57 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@dicagno
dicagno / kubectl-delete_all
Created October 27, 2020 06:16 — forked from superbrothers/kubectl-delete_all
Kubernetes: Delete all objects in the namespace
kubectl delete "$(kubectl api-resources --namespaced=true --verbs=delete -o name | tr "\n" "," | sed -e 's/,$//')" --all
@dicagno
dicagno / cgo.md
Created August 25, 2020 20:03 — forked from zchee/cgo.md
cgo convert list

See also, http://libraryofalexandria.io/cgo/

Using Go cgo

cgo has a lot of trap.
but Not "C" pkg also directory in $GOROOT/src. IDE's(vim) Goto command not works.

So, Here collect materials.

@dicagno
dicagno / fix-wsl2-dns-resolution
Created August 20, 2020 10:00 — forked from coltenkrauter/fix-wsl2-dns-resolution.md
Fix DNS resolution in WSL2
1. Create a file: /etc/wsl.conf.
2. Put the following lines in the file in order to ensure the your DNS changes do not get blown away
[network]
generateResolvConf = false
3. In a cmd window, run wsl --shutdown
4. Restart WSL2
5. Create a file: /etc/resolv.conf. If it exists, replace existing one with this new file.
6. Put the following line in the file
@dicagno
dicagno / ffserver.conf
Created August 17, 2020 13:29 — forked from snsinfu/ffserver.conf
Live-transcode RTMP stream to WebM using ffmpeg and ffserver for Chromecast
HTTPBindAddress 0.0.0.0
HTTPPort 8090
CustomLog -
<Feed feed.ffm>
File ./feed.ffm
FileMaxSize 256M
ACL ALLOW localhost
</Feed>
@dicagno
dicagno / arrayBufferToBase64.js
Created July 8, 2020 09:43 — forked from Deliaz/arrayBufferToBase64.js
Convert array buffer to base64 string
function arrayBufferToBase64(buffer) {
let binary = '';
let bytes = new Uint8Array(buffer);
let len = bytes.byteLength;
for (let i = 0; i < len; i++) {
binary += String.fromCharCode(bytes[i]);
}
return window.btoa(binary);
}
@dicagno
dicagno / reflection.go
Created May 20, 2020 09:28 — forked from drewolson/reflection.go
Golang Reflection Example
package main
import (
"fmt"
"reflect"
)
type Foo struct {
FirstName string `tag_name:"tag 1"`
LastName string `tag_name:"tag 2"`
@dicagno
dicagno / clickhousedump
Created April 25, 2020 10:07 — forked from inkrement/clickhousedump
dump all clickhouse databases and tables
#!/bin/bash
OUTDIR=.
while read -r db ; do
while read -r table ; do
if [ "$db" == "system" ]; then
echo "skip system db"
continue 2;
@dicagno
dicagno / mqtt_tls_working.ino
Created December 26, 2019 08:08 — forked from eLement87/mqtt_tls_working.ino
ESP8266 Secure MQTT Connection with Client Certificate Authentication
#include <FS.h>
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <PubSubClient.h>
#include <time.h>
// Insert your FQDN of your MQTT Broker
#define MQTT_SERVER "mqtt.srvx1.local"
const char* mqtt_server = MQTT_SERVER;