Two files:
/etc/usb_modeswitch.d/rtl8821cu/usr/share/usb_modeswitch/0bda:1a2b
TargetVendor=0x0bda
TargetProduct=0x1a2b
StandardEject=1
| # convert flac files in current directory to Apple loss-less codec. | |
| function flac2alac { | |
| for f in *.flac; do | |
| ffmpeg -i "$f" -acodec alac -vsync 2 -c:v copy -metadata COMMENT= -y "${f%.flac}.m4a" | |
| #-map_meta_data $f:${f%.flac}.m4a; | |
| done | |
| } |
| const LOG_LEVELS = ['DEBUG', 'INFO', 'WARN', 'ERROR'] | |
| const [LOG_DEBUG, LOG_INFO, LOG_WARN, LOG_ERROR] = LOG_LEVELS; | |
| const LOG_LEVEL = LOG_DEBUG; | |
| function makeLogFunc(level, func = console.log) { | |
| return LOG_LEVELS.indexOf(level) >= LOG_LEVELS.indexOf(LOG_LEVEL) ? (...msg) => { | |
| const now = new Date().toLocaleString(); | |
| func(...[now, level, ...msg]); | |
| } : () => {}; | |
| } |
| const fetch = require('node-fetch'); | |
| const { deepStrictEqual } = require('assert'); | |
| function ipv4ToInt(ip) { | |
| return ip.split('.').reduce((acc, cur) => acc << 8 | +cur, 0); | |
| } | |
| function intToIpv4(i) { | |
| return `${i >>> 24}.${i >>> 16 & 0xff}.${i >>> 8 & 0xff}.${i & 0xff}`; |
| const p = 0.723; | |
| function oldRandom() { | |
| return Math.random() < p ? 1 : 0; | |
| } | |
| const table = [[1, 2], [2, 3], [1, 3]]; | |
| let flag = 0; | |
| function newRandom() { |
| object Application { | |
| case class CsvLine(values: List[String] = Nil, inQuote: Boolean = false, buff: List[Char] = Nil) | |
| @tailrec | |
| def parseCsvLine(line: CsvLine, remains: List[Char]): List[String] = (line, remains) match { | |
| case (CsvLine(values, false, buff), Nil) => | |
| values :+ buff.mkString | |
| case (CsvLine(values, true, buff), '"' :: Nil) => | |
| values :+ buff.mkString |
| import java.util.{Timer, TimerTask} | |
| import akka.actor.{Actor, ActorSystem, Props} | |
| import akka.testkit.{ImplicitSender, TestKit} | |
| import org.scalatest.{BeforeAndAfterAll, Matchers, WordSpecLike} | |
| import scala.concurrent.{Future, Promise} | |
| import scala.util.Try |
Two files:
/etc/usb_modeswitch.d/rtl8821cu/usr/share/usb_modeswitch/0bda:1a2bTargetVendor=0x0bda
TargetProduct=0x1a2b
StandardEject=1
| ip6tables -A FORWARD -p tcp --tcp-flags RST RST -j DROP | |
| iptables -A FORWARD -p tcp --tcp-flags RST RST -j DROP |
| const asyncHooks = require('async_hooks'); | |
| const contextStore = new Map(); | |
| class Context { | |
| constructor() { | |
| this.id = Math.random(); | |
| } | |
| } |
| /* ------------ monkey patching ------------ */ | |
| const http = require('http') | |
| const originalServerEmit = http.Server.prototype.emit; | |
| http.Server.prototype.emit = function (event) { | |
| if (event === 'request') { | |
| // setup the context here as the root of the execution tree | |
| setContext(); | |
| } | |
| return originalServerEmit.apply(this, arguments) |