Skip to content

Instantly share code, notes, and snippets.

@metajiji
metajiji / nginx.conf
Last active August 29, 2015 14:14 — forked from plentz/nginx.conf
View nginx.conf
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@metajiji
metajiji / irq_balance_habrahabr_POSIX.sh
Last active August 29, 2015 19:20 — forked from pavel-odintsov/irq_balance_habrahabr.sh
irq_balance_habrahabr.sh
View irq_balance_habrahabr_POSIX.sh
#!/bin/sh
# checkbashisms irq_balance_habrahabr_POSIX.sh
# from http://habrahabr.ru/post/108240/
ncpus=$(grep -ciw ^processor /proc/cpuinfo)
[ $ncpus -gt 1 ] || exit 1
n=0
for irq in `awk '/eth/{gsub(":","",$0);print $1}' /proc/interrupts`; do
f="/proc/irq/$irq/smp_affinity"
@metajiji
metajiji / restoreperms.sh
Created January 15, 2016 04:52
Recover permissions for Ubuntu 14.04.2
View restoreperms.sh
This file has been truncated, but you can view the full file.
#!/bin/sh
#
# http://sysadminnotebook.blogspot.co.uk/2012/06/how-to-reset-folder-permissions-to.html
#
# Run me by command:
# sh restoreperms.sh
#
chown root:root /
View KVM OSX Guest 10.11 (El Capitan) with Clover.md

KVM OSX Guest 10.11 (El Capitan) with Clover

  • Some notes about this approach:
    • An OSX Installer USB drive for Install OS X El Capitan is created
    • Clover is then installed on the USB drive
    • Clover Configurator is then run on the USB drive
    • The USB drive contents are copied to the VM host
    • VNC is used to connect to the guest UI
  • The qxl virtual video device is used (part of the standard kvm qemu install)
@metajiji
metajiji / ntpdate_and_chrony.sh
Created June 1, 2017 06:30
Get local time difference with ntp server
View ntpdate_and_chrony.sh
ntpdate -q pool.ntp.org | awk 'ENDFILE{print $(NF-1)}'
chronyd -Q 'pidfile /tmp/chronyd.q' 'pool pool.ntp.org iburst' 2>&1 | awk '/wrong by/{print $(NF-2)}'
View dnsmasq-filter-aaaa.patch
From 966471712184cfb3b067f2ae8dad9d8e2a896cae Mon Sep 17 00:00:00 2001
From: Bearice Ren <bearice@icybear.net>
Date: Tue, 20 Sep 2016 11:52:08 +0800
Subject: [PATCH] add filter-aaaa option
---
src/dnsmasq.h | 3 ++-
src/option.c | 3 +++
src/rfc1035.c | 9 +++++++++
3 files changed, 14 insertions(+), 1 deletion(-)
@metajiji
metajiji / termtosvg.svg
Last active October 12, 2018 20:03
termtosvg+toilet+cowsay+lolcat
View termtosvg.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View set inifile data from yml dict
- hosts: localhost
gather_facts: no
vars:
config_ini:
section1:
key1: value11
key2: value2
section2:
key1: value21
key2: value22
@metajiji
metajiji / 000_default.conf
Last active November 9, 2018 13:43
цикл по проксям, синий трактор едет к нам
View 000_default.conf
#
# Define default virtualhost on the every node
#
server {
listen 80 default_server;
server_name _;
return 306;
}
@metajiji
metajiji / fastrrack mikrotik.md
Created November 17, 2018 05:43
fastrrack mikrotik
View fastrrack mikrotik.md

https://habr.com/post/265387/#comment_8581073

Iaroslav_Olegovich 20 сентября 2015 в 16:14 +1 Кстати, весьма полезная в некоторых случаях опция. Несколько линейных потоков скачивания извне, по 50-100Мбит на каждый укладывали RB951G на 100%. Разгон ситуацию особо не менял. А вот добавление fasttrack позволило достичь скорости в 800Мбит, при этом процессор загружен лишь на 50-60%! Speedtest также показал значения намного выше. Добавить fasttrack можно командой (прошивка должна быть не ниже 6.29):

/ip firewall filter add chain=forward action=fasttrack-connection connection-state=established,related

После чего переместить правило на нужную позицию — в большинстве конфигураций на 2 позицию после автоматически созданного «special dummy rule to show fast track counters», либо же после своих правил, если таковые имеются (в описанной конфигурации, если не ошибаюсь — между 5 и 6 пунктом).