Skip to content

Instantly share code, notes, and snippets.

View platinumthinker's full-sized avatar
🏠
Hardworking

PlatinumThinker platinumthinker

🏠
Hardworking
View GitHub Profile
This file has been truncated, but you can view the full file.
Каталог вирусов, определяемых и обезвреживаемых Dr. Web 4.00
Файл описания вирусов, определяемых и обезвреживаемых Dr. Web 4.00
В предлагаемом каталоге для каждого вируса приведена информация об его
свойствах. Символьное представление этих свойств полностью повторяет
классификационный код, предложенный Н.Н. Безруковым и Е.В. Касперским.
В качестве основных опознавателей вируса будет указываться его имя и
длина.
@platinumthinker
platinumthinker / tables_without_index.sql
Last active December 30, 2019 03:55
Slow postgress queries
SELECT
relname,
seq_scan - idx_scan AS too_much_seq,
CASE
WHEN
seq_scan - coalesce(idx_scan, 0) > 0
THEN
'Missing Index?'
ELSE
'OK'
#!/bin/bash
#
# Copyright © 2016-2019 The Thingsboard Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@platinumthinker
platinumthinker / README.md
Last active May 16, 2019 13:19
Upgrade thingsboard from 2.1 to 2.3.1

Upgrading insruction

  1. Creating cassandra snapshoot:

kubectl --namespace=thingsboard exec -it cassandra-0 -- nodetool snapshot thingsboard

  1. Deleting all k8s resources exclude cassandra:

kubectl --namespace=thingsboard delete statefulsets tb

@platinumthinker
platinumthinker / sctp_exporter.py
Created February 19, 2019 12:35
Simple sctp prometheus info exporter
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
import socketserver
import http.server
from http import HTTPStatus
regex = re.compile(r"^(\S+)\s*(\S+)$")
class Handler(http.server.SimpleHTTPRequestHandler):
#!/usr/bin/env escript
-include_lib("kernel/include/inet.hrl").
-include_lib("kernel/include/inet_sctp.hrl").
main([Protocol, IP, Port, Len, Cnt]) ->
bench(list_to_atom(Protocol), inet:parse_address(IP),
list_to_integer(Port), list_to_integer(Len), list_to_integer(Cnt));
main(_) ->
io:format("invalid arguments~n~n"),
@platinumthinker
platinumthinker / __recipe.md
Last active April 29, 2024 07:56
Cassandra backup/restore

Backup:

  1. Create snapshot:

> nodetool snapshot thingsboard (or you cat set you namespace) Requested creating snapshot(s) for [all keyspaces] with snapshot name [1522059918232] and options {skipFlush=false} Snapshot directory: 1522059918232

  1. Copy snapshot on another directory:
[Unit]
Description=CAPWAP Datapath element
[Service]
ExecStart=/usr/local/bin/capwap-dp -c /etc/ergw-capwap-node/capwap-dp.conf
ExecStartPost=/bin/ip link set tap0 up
ExecStartPost=/bin/ip addr add 192.168.85.1/24 dev tap0
Restart=always
Type=simple
;User=thinker
@platinumthinker
platinumthinker / kuber.md
Last active August 17, 2017 06:05
kubernates

Autorize from k8s pod:

export KUBE_TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)
curl -sSk -H "Authorization: Bearer $KUBE_TOKEN" https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_PORT_443_TCP_PORT/api/v1/namespaces/$POD_NAMESPACE/

Connect to docker in minikube from host:

eval $(minikube docker-env)
@platinumthinker
platinumthinker / dd.md
Last active July 19, 2017 06:58
Linix disk perfomance

Run in console:

dd bs=1M count=256 if=/dev/zero of=test conv=fdatasync oflag=dsync
Disk SATA Gb/s Speed with oflag Mb/s Speep without oflag Mb/s
Intel SSD 540S 1.5 43.4 106
Intel SSD 530 ( SSDSC2BW12 ) 1.5 41 310