Skip to content

Instantly share code, notes, and snippets.

# Author: Aram Grigorian <aram@opendns.com>
# https://github.com/aramg
# https://github.com/opendns
#
# By default, nginx will close upstream connections after every request.
# The upstream-keepalive module tries to remedy this by keeping a certain minimum number of
# persistent connections open at all times to upstreams. These connections are re-used for
# all requests, regardless of downstream connection source. There are options available
# for load balacing clients to the same upstreams more consistently.
# This is all designed around the reverse proxy case, which is nginxs main purpose.
@nxtreaming
nxtreaming / install_bbr_on_ubuntu.sh
Created March 13, 2018 11:33 — forked from kxfeng/install_bbr_on_ubuntu.sh
install bbr on ubuntu
# download linux kenel
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/<version>/linux-headers-<version>_all.deb
wgte http://kernel.ubuntu.com/~kernel-ppa/mainline/<version>/linux-headers-<version>-generic_<version>_arm64.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/<version>/linux-image-<version>-generic_<version>_amd64.deb
# intsall linux kenel
sudo dpkg -i *.deb
# unintsall old kenel
dpkg -l|grep linux-image
@nxtreaming
nxtreaming / Cmd_stats
Created March 31, 2018 05:37 — forked from Toboe/Cmd_stats
linux,tools,stats,commands
Curl
feh --thumbnails --index-info "%n\n%wx%h"
feh --list
feh --draw-tinted --info "exifgrep '(Model|DateTimeOriginal|FNumber|ISO|Flash|ExposureTime|FocalLength.\\*)' '%f' | cut -d . -f 4-"
feh -t modular/setup/environment/wallpaper/ --thumb-height 120 --thumb-width 120 -S width -n -d --cache-thumbnails
mplayer -ss 670 -frames 1 -vo jpeg -nosound movie.avi
mplayer -ao null -ss 0:51:48 -endpos 15 -vo gif89a:output=16.gif:fps=17 palette,format=bgr=24 Ololo.avi
ffmpeg -i movie.mp4 -vcodec copy -acodec copy -ss 00:37:40 -t 00:01:10 /mnt/destvideo.mp4
@nxtreaming
nxtreaming / squid.conf
Created April 9, 2018 06:06 — forked from hardikdangar/squid.conf
squid.conf
# General
http_port 3130
http_port 3128 intercept
https_port 3129 intercept ssl-bump cert=/etc/squid/ssl_cert/srtpl.pem generate-host-certificates=on dynamic_cert_mem_cache_size=4MB
acl DiscoverSNIHost at_step SslBump1
acl NoSSLIntercept ssl::server_name_regex -i "/etc/squid/url.nobump"
ssl_bump splice NoSSLIntercept
ssl_bump peek DiscoverSNIHost
@nxtreaming
nxtreaming / get_macs.yml
Created May 3, 2019 07:58 — forked from tbondarchuk/get_macs.yml
Ansible: Get mac addresses of all interfaces except local
---
- hosts: all
tasks:
- name: Get mac addresses of all interfaces except local
debug:
msg: "{{ ansible_interfaces | difference(['lo']) | map('regex_replace', '^(.*)$', 'ansible_\\1' ) | map('extract', hostvars[inventory_hostname], 'macaddress') | list }}"
Add-Type -TypeDefinition @'
using System;
using System.Runtime.InteropServices;
namespace ProcessInfo
{
public class NativeMethods
{
[DllImport("User32.dll", SetLastError = true)]
public static extern bool CloseDesktop(
@nxtreaming
nxtreaming / ffmpeg-web-video-guide.md
Created October 13, 2020 02:33 — forked from jaydenseric/ffmpeg-web-video-guide.md
A quick guide to using FFmpeg to create cross-device web videos.

Video conversion with FFmpeg

Install

On mac:

  1. Download the latest release.
  2. Extract the binary and place it in /usr/local/bin.

Command basics

@nxtreaming
nxtreaming / ffmppeg-advanced-playbook-nvenc-and-libav-and-vaapi.md
Created October 13, 2020 06:49 — forked from Brainiarc7/ffmppeg-advanced-playbook-nvenc-and-libav-and-vaapi.md
FFMpeg's playbook: Advanced encoding options with hardware-accelerated acceleration for both NVIDIA NVENC's and Intel's VAAPI-based hardware encoders in both ffmpeg and libav.

FFmpeg and libav's playbook: Advanced encoding options with hardware-based acceleration, NVIDIA's NVENC and Intel's VAAPI-based encoder.

Hello guys,

Continuing from this guide to building ffmpeg and libav with NVENC and VAAPI enabled, this snippet will cover advanced options that you can use with ffmpeg and libav on both NVENC and VAAPI hardware-based encoders.

For ffmpeg:

@nxtreaming
nxtreaming / Convert audio to video with ffmpeg - examples.md
Created January 14, 2023 10:19 — forked from Neurogami/Convert audio to video with ffmpeg - examples.md
A list of examples on how you can use filters to make visual representations of audio using ffmpeg

Convert audio to video with ffmpeg - examples

ffmpeg -i input.mp3 -filter_complex "[0:a]avectorscope=s=1920x1080,format=yuv420p[v]" -map "[v]" -map 0:a avectorscope.mp4
ffmpeg -i input.mp3 -filter_complex "[0:a]showcqt=s=1920x1080,format=yuv420p[v]" -map "[v]" -map 0:a showcqt.mp4
ffmpeg -i input.mp3 -filter_complex "[0:a]ahistogram=s=1920x1080,format=yuv420p[v]" -map "[v]" -map 0:a ahistogram.mp4

介绍

由于GFW的域名黑名单是不断变化的,如果所有DNS查询都走VPN会丧失CDN加速功能,经常出现本地电信线路,但是却访问网站的联通线路,而且当VPN线路不稳定的时候,会影响所有网站的访问。如果使用域名白名单或黑名单,对于经常访问外国网站的用户,体验很不好,需要用户自己维护域名列表。 该文章介绍如何通过判断并丢弃包含特征IP的DNS包来防止DNS污染,但是又不会失去本地DNS的CDN加速功能,而且还不需要VPN。

前期准备

  • 一台Openwrt路由器
  • 使用dnsmasq作为Openwrt的dns服务器
  • 安装 dig (opkg install bind-dig bind-libs)
  • 安装 iptables 的 string 模块及对应的内核模块 (opkg install iptables-mod-filter kmod-ipt-filter)