Skip to content

Instantly share code, notes, and snippets.

@TheCase
TheCase / filebeats-remove_ansi_coloring.yaml
Last active November 30, 2023 08:53
Filbeats - remove ansi control characters for colored logs
- script:
when:
regexp:
message: "[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]"
lang: javascript
id: remove_ansi_color
source: >
function process(event) {
var msg = event.Get("message")
var regex = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g
@TheCase
TheCase / _commands
Last active November 28, 2018 15:18
nomad sample
yum -y install python-setuptools unzip wget
easy_install pip
pip install supervisor
wget https://releases.hashicorp.com/consul/0.8.0/consul_0.8.0_linux_amd64.zip
unzip consul*.zip
mkdir -p /opt/consul/data
mv consul /opt/consul
@TheCase
TheCase / dev-input
Created March 5, 2018 04:53
after replug
pi@retropi:/dev/input $ tree /dev/input/
/dev/input/
|-- by-id
| |-- usb-1241_1111-event-mouse -> ../event7
| |-- usb-1241_1111-mouse -> ../mouse0
| |-- usb-Apple_Inc._Apple_Keyboard-event-if01 -> ../event6
| |-- usb-Apple_Inc._Apple_Keyboard-event-kbd -> ../event5
| |-- usb-XGaming_X-Arcade-event-kbd -> ../event0
| `-- usb-XGaming_X-Arcade-if01-event-kbd -> ../event1
|-- by-path
@TheCase
TheCase / dmesg
Created March 5, 2018 04:52
raspi after boot
[ 2.766152] usb 1-1.4: new low-speed USB device number 5 using dwc_otg
[ 2.910606] usb 1-1.4: New USB device found, idVendor=1241, idProduct=1111
[ 2.910617] usb 1-1.4: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 2.916233] fuse init (API version 7.26)
[ 2.932977] input: HID 1241:1111 as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.0/0003:1241:1111.0001/input/input0
[ 2.952501] hid-generic 0003:1241:1111.0001: input,hidraw0: USB HID v1.00 Mouse [HID 1241:1111] on usb-3f980000.usb-1.4/input0
$(document).ready(function() {
$('#list-users-button').click(function(){
$.getJSON('https://jsonplaceholder.typicode.com/users',
function (data) {
//console.log("> ", data);
$("#list-results-table tbody").append("<table>");
for ($i=0; $i < data.length; $i++){
$("#list-results-table tbody").append('<tr><td>' + data[$i].name + '</td></tr>');
@TheCase
TheCase / maddy_config_bundle.ini
Created October 16, 2017 23:22
Slic3r bundle for Maddy Mendel Max
# generated by Slic3r 1.2.9 on Sat May 21 11:38:50 2016
[filament:faberdashery]
bed_temperature = 65
bridge_fan_speed = 100
cooling = 1
disable_fan_first_layers = 2
extrusion_multiplier = 1
fan_always_on = 0
fan_below_layer_time = 60
# Config Section
# columns, rows per window
set cols to 80
set rows to 50
# first window, pixels down from top of screen
set top_margin to 0
# pixels per terminal column - this might vary by screen - use screencap to show pixel count
@TheCase
TheCase / check_pfsense_dpinger
Last active May 6, 2017 16:50
gateway check for pfSense
#!/bin/sh
# add this file as /usr/local/libexec/check_pfsense_dpinger
# apinger is gone. This is a new RTT check based on output available from the dpinger sockets
FILES=$(find /var/run | grep dpinger | grep sock)
stateid=0
message=''
@TheCase
TheCase / commands.cfg
Created May 4, 2017 03:39
slack notifier for nagios/shinken in bash
define command {
command_name notify_host_by_slack
command_line $NAGIOSPLUGINSDIR$/post_to_slack.sh host $HOSTSTATE$ $NOTIFICATIONTYPE$ $HOSTNAME$ nil "$HOSTOUTPUT$" $CONTACT_PAGER$
}
define command {
command_name notify_service_by_slack
command_line $NAGIOSPLUGINSDIR$/post_to_slack.sh service $SERVICESTATE$ $NOTIFICATIONTYPE$ $HOSTNAME$ "$SERVICEDESC$" "$SERVICEOUTPUT$" $CONTACTPAGER$
}
root@raspberrypi:/opt# ./infinitive -httpport=80 -serial=/dev/ttyUSB0
INFO[0000] opening serial interface: /dev/ttyUSB0
[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
- using env: export GIN_MODE=release
- using code: gin.SetMode(gin.ReleaseMode)
[GIN-debug] GET /api/zone/1/config --> main.webserver.func1 (3 handlers)
[GIN-debug] GET /api/zone/1/vacation --> main.webserver.func2 (3 handlers)
[GIN-debug] PUT /api/zone/1/vacation --> main.webserver.func3 (3 handlers)
[GIN-debug] PUT /api/zone/1/config --> main.webserver.func4 (3 handlers)