INT 21h

Hi, I am Vladimir Smagin, SysAdmin and Kaptain. Telegram Email / GIT / RSS / GPG

How to make your screen absolutely red for night use with RedShift

№ 11513 В разделе Sysadmin от January 15th, 2022,
В подшивках:

Install RedShift, run:

redshift -o -t 1000:1000 -l 0.0:0.0

To reset:

redshift -x

Нет комментариев »

Mikrotik: unicode symbols in wifi name (ssid)

№ 11507 В разделе Sysadmin от December 20th, 2021,
В подшивках:

You can’t enter unicode symbols directly in wifi name field in winbox, but it can be done with terminal. This page generates command string with some unicode symbols https://r-1.ch/mikrotik-unicode-ssid-generator.php.

For example, you can use popular meme about 5G towers and covid19 “📡 COVID19 5G TEST TOWER ☣”

Нет комментариев »

MQTT periodic messages on Microtik

№ 11399 В разделе Sysadmin от December 19th, 2021,
В подшивках: ,

Activate IoT package

Add your MQTT

Create new script

:local broker "home"
:local topic "/router"
:put ("[*] Gathering system info...")
:local cpuLoad [/system resource get cpu-load]
:local freeMemory [/system resource get free-memory]
:local usedMemory ([/system resource get total-memory] - $freeMemory)
:local rosVersion [/system package get value-name=version \
    [/system package find where name ~ "^routeros"]]
:local model [/system routerboard get value-name=model]
:local serialNumber [/system routerboard get value-name=serial-number]
:local upTime [/system resource get uptime]

:local message \
    "{\"model\":\"$model\",\
                \"sn\":\"$serialNumber\",\
                \"ros\":\"$rosVersion\",\
                \"cpu\":$cpuLoad,\
                \"umem\":$usedMemory,\
                \"fmem\":$freeMemory,\
                \"uptime\":\"$upTime\"}"

:log info "$message";
:put ("[*] Total message size: $[:len $message] bytes")
:put ("[*] Sending message to MQTT broker...")
/iot mqtt publish broker=$broker topic=$topic message=$message
:put ("[*] Done")

Now create new schedule

Now check out your MQTT messages

Нет комментариев »

Golang: set variable during build

№ 11467 В разделе Programming от December 12th, 2021,
В подшивках:

Useful to set version or build number. Also you can use embed.

Code:

package main

import "fmt"

var MyVariable = "jopa"

func main() {
	fmt.Printf("%s\n", MyVariable)
}

Build script:

#!/usr/bin/bash

ENVVAR="jopa i piska"

LDFLAGS=(
  "-X 'main.MyVariable=${ENVVAR}'"
)

go build -o testvar -ldflags="${LDFLAGS[*]}" main.go
./testvar

rm -f ./testvar

Output:

$ ./build.sh 
jopa i piska

Нет комментариев »

Яндекс.Метрика

Fortune cookie: "'Theocracy' has always been the synonym for a bleak and narrow, if not a fierce and blood-stained tyranny." [William Archer (1667-1735)]