Skip to content

Instantly share code, notes, and snippets.

@analogic
analogic / .drone.yml
Created March 18, 2019 07:58
Moving from cloud.docker.com autobuild+autotest to drone.io (repository must be privileged!§)
kind: pipeline
name: default
steps:
- name: test
image: docker:dind
privileged: true
pull: true
volumes:
- name: dockersock
@analogic
analogic / autolink.dart
Created October 15, 2018 10:28
Flutter method to create text with autodetected links
@analogic
analogic / radacct.sql
Last active February 27, 2018 14:07
FreeRADIUS Accounting per month
CREATE TABLE IF NOT EXISTS `data_month` (
`calledstationid` VARCHAR(50),
`in_octets` BIGINT(20) DEFAULT 0,
`out_octets` BIGINT(20) DEFAULT 0,
`year` INT(4),
`month` INT(2),
`last_update` DATETIME,
PRIMARY KEY (`calledstationid`, `year`, `month`)
) ENGINE MyISAM;
@analogic
analogic / data-raw.sql
Created February 27, 2018 07:59
FreeRadius Accounting
CREATE TABLE IF NOT EXISTS `data_raw` (
`acctsessionid` varchar(32) COLLATE utf8_czech_ci DEFAULT NULL,
`username` varchar(64) COLLATE utf8_czech_ci DEFAULT NULL,
`nasipaddress` varchar(15) COLLATE utf8_czech_ci DEFAULT NULL,
`acctsessiontime` int(11) DEFAULT NULL,
`acctinputoctets` bigint(20) DEFAULT NULL,
`acctoutputoctets` bigint(20) DEFAULT NULL,
`prev_acctsessiontime` int(11) DEFAULT NULL,
`prev_acctinputoctets` bigint(20) DEFAULT NULL,
`prev_acctoutputoctets` bigint(20) DEFAULT NULL,
nainstalovano
asterisk/stable,stable,now 1:13.14.1~dfsg-2+deb9u2 amd64 [installed]
asterisk-config/stable,stable,now 1:13.14.1~dfsg-2+deb9u2 all [installed,automatic]
asterisk-core-sounds-en/stable,now 1.4.27-1 all [installed,automatic]
asterisk-core-sounds-en-gsm/stable,now 1.4.27-1 all [installed,automatic]
asterisk-modules/stable,stable,now 1:13.14.1~dfsg-2+deb9u2 amd64 [installed,automatic]
--------------------------------------------------------------------------------------
mozno nainstalovat
This file has been truncated, but you can view the full file.
2017-12-21 14:26:32.000 19.000 165 178.248.57.155:0 -> 0.0.0.0:0 6 360 1
2017-12-21 14:26:52.000 0.000 Trnk2 178.248.60.111:0 -> 1.187.199.176:0 1 1452 1
2017-12-21 14:26:47.000 0.000 ARGUS 178.248.57.155:0 -> 242.122.114.126:0 1 60 1
2017-12-21 14:26:32.000 19.000 165 178.248.57.155:0 -> 0.0.0.0:0 6 360 1
2017-12-21 14:26:47.000 3.000 168 178.248.60.12:0 -> 1.187.212.95:0 6 8784 1
2017-12-21 14:26:52.000 0.000 TCP 178.248.56.193:50068 -> 81.0.212.201:443 1 85 1
2017-12-21 14:26:32.000 16.000 ISOIP 178.248.57.155:0 -> 205.95.26.225:0 6 3296 1
2017-12-21 14:26:52.000 0.000 TCP 178.248.62.162:64292 -> 77.75.78.69:443 1 66 1
2017-12-21 14:26:52.000 0.000 255 178.248.56.193:0 -> 1.187.195.191:0 1 60 1
2017-12
.| IPV4_SRC_ADDR | IPV4_DST_ADDR | IPV4_NEXT_HOP | IN_PKTS | IN_BYTES | FIRST_SWITCHED | LAST_SWITCHED | BGP_IPV4_NEXT_HOP | INPUT_SNMP | OUTPUT_SNMP | L4_SRC_PORT | L4_DST_PORT | SRC_AS | DST_AS | SRC_VLAN | DST_VLAN | UNKNOWN_TYPE_232 | TCP_FLAGS | PROTOCOL | SRC_TOS | SRC_MASK | DST_MASK | DIRECTION | FORWARDING_STATUS | UNKNOWN_TYPE_326 |
| 178.248.58.59 | 205.185.216.10 | 85.207.213.133 | 1 | 60 | 202h52m19s | 202h52m19s | 0.0.0.0 | 49 | 22 | 49653 | 443 | 0 | 0 | 0 | 17652 | n/a | R | 0x06 | 0x00 | 24 | 0 | Egress | 0x00 | n/a |
| 178.248.56.193 | 0.80.13.149 | 85.207.213.133 | 1 | 1464 | 202h52m24s | 202h52m24s | 0.0.0.0 | 22 | 22 | 0 | 0 | 0 | 0 | 0 | 501 | n/a | | 0x3d | 0x4a | 24 | 0 | Ingress | 0x00 |
@analogic
analogic / docker-compose.yml
Last active February 20, 2024 14:20
Poste.io (with Lets Encrypt) + Nginx reverse proxy + Nginx Lets encrypt companion
version: '3'
services:
nginx-proxy:
image: jwilder/nginx-proxy
labels:
com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true"
container_name: nginx-proxy
restart: unless-stopped
ports:
package main
import (
"fmt"
"runtime"
"time"
"bytes"
"strings"
"github.com/kidoman/embd"
@analogic
analogic / expecting.md
Created May 24, 2017 11:21 — forked from ksafranski/expecting.md
Basic principles of using tcl-expect scripts

Intro

TCL-Expect scripts are an amazingly easy way to script out laborious tasks in the shell when you need to be interactive with the console. Think of them as a "macro" or way to programmaticly step through a process you would run by hand. They are similar to shell scripts but utilize the .tcl extension and a different #! call.

Setup Your Script

The first step, similar to writing a bash script, is to tell the script what it's executing under. For expect we use the following:

#!/usr/bin/expect