Skip to content

Instantly share code, notes, and snippets.

View danyanya's full-sized avatar
🤔
status: working

Daniil Sliusar danyanya

🤔
status: working
View GitHub Profile
@danyanya
danyanya / aerohive.md
Created December 19, 2022 06:02 — forked from samdoran/aerohive.md
Configuring Aerohive access points using the CLI

Aerohive

Initial setup

  1. Reset to factory defaults

     reset config bootstrap
     reset config
    
  2. Configure interfaces

@danyanya
danyanya / docker-compose.yml
Created December 2, 2022 11:53
socat proxy
version: '3.3'
services:
ise-radius-auth:
image: alpine/socat
restart: always
# change 10.40.100.222 for your IP
command: UDP4-RECVFROM:1883,fork,reuseaddr UDP4-SENDTO:10.40.100.222:1812
ports:
- 0.0.0.0:8812:1812
logging:
@danyanya
danyanya / loader.sh
Created September 5, 2022 11:30
MIkrotik TFTP script
#!/bin/bash
# Usage: bash loader.sh file.bin enp5s0
USER=${USER}
IFNAME=$2
/sbin/ip addr replace 192.168.99.10/24 dev $IFNAME
/sbin/ip link set dev $IFNAME up
/usr/sbin/dnsmasq --user=$USER \
--no-daemon \
--listen-address 192.168.99.10 \
@danyanya
danyanya / sshpass.sh
Created July 29, 2022 15:34
magic ssh restarter script
ADDR=$1
USER=$2
PASS=$3
KEYS='-q -o ServerAliveInterval=2 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
SSHPASS="sshpass -p $PASS ssh $KEYS $USER@$ADDR"
$SSHPASS cpeagent restart
@danyanya
danyanya / gist:b0d1a04af9a89ffbc0a4dfa9f19c6374
Created April 29, 2022 15:37
qcom-ipq4019-yuncore-xd6800.dts
#include "qcom-ipq4019.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
/ {
model = "Yuncore XD6800";
compatible = "yuncore,xd6800", "qcom,ipq4019";
soc {
mdio@90000 {
@danyanya
danyanya / setup.sh
Created November 1, 2021 11:03
OpenWRT: basic packages for our usage
# Install additional pkgs via opkg
opkg update
# All possible modems pkgs
opkg install usb-modeswitch kmod-mii kmod-usb-net kmod-usb-net-cdc-ether kmod-usb-net-cdc-mbim kmod-usb-net-cdc-ncm kmod-usb-net-huawei-cdc-ncm kmod-usb-net-qmi-wwan kmod-usb-net-rndis kmod-usb-wdm kmod-usb-net-qmi-wwan kmod-usb-net-asix kmod-usb-net-asix-ax88179 kmod-usb-net-ipheth usbmuxd libimobiledevice uqmi wwan umbim comgt comgt-ncm usbreset
opkg install kmod-usb-ohci-pci kmod-usb2-pci kmod-usb-serial-option kmod-usb-serial kmod-usb-serial-wwan usbutils
# StrongSwan for IPSec - Control plane
opkg install strongswan-minimal
# SNMP daemon
opkg install mini_snmpd
# LUA libs
@danyanya
danyanya / rssi.go
Created April 13, 2020 11:47
golang client distance from rssi and mhz
package rssi
import (
"math"
)
const (
// from wiki original formula: https://en.wikipedia.org/wiki/Free-space_path_loss
fsplConstant = 27.55
)
@danyanya
danyanya / main.go
Last active January 17, 2020 16:08
golang vk auth for account bdate, email, sex, etc (based on https://github.com/kovetskiy/go-vk)
package main
import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
@danyanya
danyanya / mongo-coll-indexes.js
Last active December 25, 2019 11:58
mongodb export indexes with expiration
var always_background = true;
db.getCollectionNames().forEach(function(collection) {
indexes = db.getCollection(collection).getIndexes();
if(indexes && indexes.length>0) {
print("//Indexes for " + collection + ":");
indexes.forEach(function(index) {
var options = {};
if(index.unique) {
options.unique = index.unique;
}
# One line JS code to check MongoDB collection storageSize
var collectionNames = db.getCollectionNames(), stats = []; collectionNames.forEach(function (n) { stats.push(db.getCollection(n).stats()); }); stats = stats.sort(function(a, b) { return b['storageSize'] - a['storageSize']; }); for (var c in stats) { print(stats[c]['ns'] + ": " + stats[c]['size'] + " (" + stats[c]['storageSize'] + ")"); }