Skip to content

Instantly share code, notes, and snippets.

View Jinnmv's full-sized avatar

Anton S Jinnmv

View GitHub Profile
@Jinnmv
Jinnmv / README.md
Last active June 16, 2022 15:40
Ads Hosts for Mikrotik static DNS blocking
  1. Upload adblock.rsc to the Microtik router file system
  2. Run imported file by /import adblock.rsc
  3. Optionally Remove imported file /file remove adblock.rsc
  4. Create new Firewall rule (IP > Firewall > Filter Rules)
    • chain: forward
    • protocol: tcp and udp (another one rule)
    • In interface/list: LAN or whatever inner you use
    • Connection state: new
  • Action: reject
@Jinnmv
Jinnmv / xiaomi_dns_block.lst
Last active December 15, 2022 22:40
PiHole DNS Blocklist Xiaomi
# This is a DNS blocklist for the PiHole (https://pi-hole.net/) to block unnecessary connections to Xiaomi on the Internet.
# Please help to collect domains!
abtest.mistat.intl.xiaomi.com
abtest.mistat.xiaomi.com
ad1.xiaomi.com
ad.mi.com
adv.sec.intl.miui.com
adv.sec.miui.com
ad.xiaomi.com
@Jinnmv
Jinnmv / api_FTL.php.patch
Last active September 7, 2022 12:01
Unbound widgets for Pi-hole
// /var/www/html/admin/api_FTL.php
// Add 4 new parameters to the API response, around line 60 of the file
--- a/api_FTL.php
+++ b/api_FTL.php
@@ -62,6 +62,10 @@ else
$stats[$tmp[0]] = floatval($tmp[1]);
}
}
+ $stats['unbound_total_queries'] = shell_exec("grep -Po 'total.num.queries=\K[0-9]+$' < unbound_stats.txt");
@Jinnmv
Jinnmv / unbound.conf
Last active March 4, 2021 19:51
pihole
#/etc/unbound/unbound.conf.d/pihole.conf
server:
# If no logfile is specified, syslog is used
logfile: "/var/log/unbound/unbound.log"
verbosity: 0
interface: 127.0.0.1
port: 5335
do-ip4: yes
do-udp: yes
@Jinnmv
Jinnmv / 0_reuse_code.js
Created November 5, 2015 12:25
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Jinnmv
Jinnmv / .csscomb.json
Created September 9, 2015 22:46
My CSS Comb config
{
"remove-empty-rulesets": true,
"always-semicolon": true,
"color-case": "upper",
"block-indent": "\t",
"color-shorthand": true,
"element-case": "lower",
"eof-newline": true,
"leading-zero": false,
"quotes": "single",
@Jinnmv
Jinnmv / rotrrent
Last active August 29, 2015 14:26
Run rotorrent as upstart daemon under dtach
#! /bin/sh
### BEGIN INIT INFO
# Provides: rtorrent
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts rtorrent as service
# Description: starts rtorrent using start-stop-daemon and dtach
### END INIT INFO
  1. to be sure that everything is installed:

npm install --save-dev gulp-sass gulp-sourcemaps gulp-autoprefixer gulp-rename gulp-replace gulp-csso gulp-imagemin imagemin-pngquant gulp-livereload gulp-changed gulp-cached gulp-combine-media-queries gulp-watch gulp-connect gulp-shorthand

  1. Now next commands are available:
  • gulp - run gulp in serve mode with autoreload
  • gulp server - starts webserver at localhost:3000 with autoreload
  • gulp build - copy all files from _src to _dist saving hieratchy
@Jinnmv
Jinnmv / gist:2f4ae3329213977ca304
Last active August 29, 2015 14:04
limited array
function HistoryList (size) {
this.size = size;
}
HistoryList.prototype.history = [];
HistoryList.prototype.push = function (element) {
if (this.history.length = this.size) this.history.shift();
this.history.push(element);
@Jinnmv
Jinnmv / ftrim.service
Last active May 28, 2016 22:36
Script to run fstrim on root and log results to /var/log/trim.log in user-friendly meaner
#/etc/systemd/system/ftrim.service
[Unit]
Description=Run fstrim on startup
[Service]
Type=oneshot
ExecStart=/bin/sh -c "echo $(date -R): $(fstrim --all --verbose) >> /var/log/fstrim.log"
[Install]
WantedBy=multi-user.target