Skip to content

Instantly share code, notes, and snippets.

View zerosign's full-sized avatar
🏠
Working from home

zerosign zerosign

🏠
Working from home
View GitHub Profile
@zerosign
zerosign / trace_udp_rcvbuferrors.bt
Created June 4, 2022 08:51 — forked from Quentin-M/trace_udp_rcvbuferrors.bt
trace_udp_rcvbuferrors.bt
// Tracks the origin of net_udp_rcvbuferrors, printing socket metadata associated with the packet drops.
//
// usage: bpftrace trace_udp_rcvbuferrors.bt
// sample output:
// 12:32:25 iperf3/3391 ::ffff:192.168.60.3:5201 -> ::ffff:192.168.60.1:50512 retval=-1 dropped=23809 qlen=36 qsize/qmaxsize=213248/212992 bytes
kprobe:udp_queue_rcv_skb
{
$sock = (struct sock *)arg0;
if ($sock->sk_type != SOCK_DGRAM || ($sock->__sk_common.skc_family != AF_INET && $sock->__sk_common.skc_family != AF_INET6)) {
@zerosign
zerosign / WaylandUbuntu19.10-AppTitle
Last active July 11, 2021 15:31 — forked from rbreaves/WaylandUbuntu19.10-AppTitle
Grab wmclass name or Window Name/Title under Wayland with Gnome 3.x
gdbus call -e -d org.gnome.Shell -o /org/gnome/Shell -m org.gnome.Shell.Eval "global.get_window_actors().filter(a=>a.meta_window.has_focus()===true)[0]?.get_meta_window()?.get_wm_class()"
@zerosign
zerosign / emulator-install-using-avdmanager.md
Created February 28, 2021 12:38 — forked from mrk-han/emulator-install-using-avdmanager.md
Installing and creating Emulators with AVDMANAGER (For Continuous Integration Server or Local Use)

Install and Create Emulators using AVDMANAGER and SDKMANAGER

TL;DR

For generic skin emulator with default apis (without google apis):

  1. List All System Images Available for Download: sdkmanager --list | grep system-images

  2. Download Image: sdkmanager --install "system-images;android-29;default;x86"

@zerosign
zerosign / ffmpeg-livestream-to-streaming-sites-vaapi-nvenc.md
Created February 15, 2020 06:29 — forked from Brainiarc7/ffmpeg-livestream-to-streaming-sites-vaapi-nvenc.md
ffmpeg livestreaming to youtube via Nvidia's NVENC and Intel's VAAPI on supported hardware

Streaming your Linux desktop to Youtube and Twitch via Nvidia's NVENC and VAAPI:

Considerations to take when live streaming:

The following best practice observations apply when using a hardware-based encoder for live streaming to any platform:

  1. Set the buffer size (-bufsize:v) equal to the target bitrate (-b:v). You want to ensure that you're encoding in CBR mode.

  2. Set up the encoders as shown:

@zerosign
zerosign / indylambda.md
Created January 22, 2019 05:52 — forked from retronym/indylambda.md
indylambda: Putting invokedynamic to work for Scala

indylambda: Putting invokedynamic to work for Scala

Java 8 introduced lambdas to the Java language. While the design choices differ in many regards from Scala's functions, the underlying mechanics used to represent Java lambdas is flexible enough to be used as a target for the Scala compiler.

Lambdas in Java

Java does not have canonical heirarchy of generic function types (ala scala.FunctionN), but instead allows a lambda to be used as a shorthand for an anonymous implementation of an Functional Interface

Here's an example of creating a predicate that closes over one value:

@zerosign
zerosign / upload-github-release-asset.sh
Created November 22, 2018 07:31 — forked from stefanbuck/upload-github-release-asset.sh
Script to upload a release asset using the GitHub API v3.
#!/usr/bin/env bash
#
# Author: Stefan Buck
# License: MIT
# https://gist.github.com/stefanbuck/ce788fee19ab6eb0b4447a85fc99f447
#
#
# This script accepts the following parameters:
#
# * owner
@zerosign
zerosign / git-compressing-and-deltas.md
Created June 22, 2018 08:45 — forked from matthewmccullough/git-compressing-and-deltas.md
Git, Compression, and Deltas - An explanation

Git Compression of Blobs and Packfiles.

Many users of Git are curious about the lack of delta compression at the object (blob) level when commits are first written. This efficiency is saved until the pack file is written. Loose objects are written in compressed, but non-delta format at the time of each commit.

A simple run though of a commit sequence with only the smallest change to the image (in uncompressed TIFF format to amplify the observable behavior) aids the understanding of this deferred and different approach efficiency.

The command sequence:

Create the repo:

@zerosign
zerosign / log-linear-goto-intuition.md
Created May 16, 2018 15:48 — forked from nathansobo/log-linear-goto-intuition.md
Intuition for `merge_op` in Raph Levein's GOTO implementation

When merging an operation O, there may be several operations scattered through the local history that are concurrent to O. We need to rearrange our history so that all of these concurrent operations are moved to the end of the history. Then we can transform O against each of these concurrent operations and append it to the end.

Say we're adding O a history with the following suffix. The operations surrounded by vertical bars are concurrent to O. Otherwise the operations causally precede O.

EO0 |EO1| EO2 EO3 |EO4| |EO5| EO6

We need to rearrange this history so it looks like this.

@zerosign
zerosign / firefox.md
Created October 31, 2017 00:30
Configuring Firefox for security and privacy (as of Oct. 2017)

Configuring/Hardening Firefox for Security and Privacy

Source for some of these

  1. about:config
  • dom.event.clipboardevents.enabled => false
  • clipboard.plainTextOnly => true
  • referer spoofSource => true
  • media.peerconnection