Skip to content

Instantly share code, notes, and snippets.

@sarjsheff
sarjsheff / config.sh
Created June 8, 2021 12:23
kafka key compaction
kafka-topics.sh --bootstrap-server localhost:9092 --create --topic testunique --config cleanup.policy=compact --config max.compaction.lag.ms=60000 --config min.cleanable.dirty.ratio=0.1
@sarjsheff
sarjsheff / show.sh
Last active January 1, 2025 19:52
openwrt traffic accounting by ip
# get statistics in json from console
ubus call traff all
@sarjsheff
sarjsheff / test.sh
Last active April 27, 2021 07:09
ubus openwrt
# 10 last log messages
ubus -v call log read '{"lines":10,"stream":false,"oneshot":true}'
# boardinfo
ubus call system board
# system stat
ubus call system info
@sarjsheff
sarjsheff / filter.sh
Created April 26, 2021 16:17
iptables lua
# opkg install iptables-mod-lua
iptables -A INPUT -j LUA --script ./script.lua
@sarjsheff
sarjsheff / app-pom.xml
Created April 14, 2021 09:37
maven ssh repository
...
<repositories>
<repository>
<id>ssh-repository</id>
<url>scp://192.168.1.1/maven</url>
</repository>
</repositories>
<build>
<extensions>
@sarjsheff
sarjsheff / dtest.sh
Last active February 9, 2021 15:36
docker test
#!/bin/sh
#docker rm -f $(docker ps -a -q)
for I in $(seq 1 50)
do
docker run --name nginx$I -p 90$I:80 -d nginx &
pids[${i}]=$!
done
@sarjsheff
sarjsheff / example.md
Last active October 27, 2020 09:04
Sequelize associations

Model

...
  User.init(
    {
      username: { type: DataTypes.STRING, primaryKey: true },
      password: { ...def },
      fio: { ...def },
    },
@sarjsheff
sarjsheff / job.sh
Created August 19, 2020 18:49
Script for always restart service. +ash +openwrt
#!/bin/sh
if [ -z ${1} ]
then
echo "Set shell script."
else
trap 'kill $(jobs -p);logger exit;exit' SIGINT SIGTERM EXIT
for i in `seq 1 50000`
do
@sarjsheff
sarjsheff / inline.sh
Created August 18, 2020 19:00
Video on background OSX
vlc --video-wallpaper --zoom 2 --no-osd <url>
@sarjsheff
sarjsheff / cors.js
Created June 13, 2020 17:04
Allow CORs for Express
...
app.use((r, rs, n) => {
rs.setHeader("Access-Control-Allow-Origin", "*")
rs.setHeader("Content-Type", "application/json")
rs.setHeader("Access-Control-Allow-Methods", "GET,PUT,POST,DELETE")
rs.setHeader("Access-Control-Allow-Headers", "Content-Type")
n();
})
...