Skip to content

Instantly share code, notes, and snippets.

Avatar

Jonas Schievink jonas-schievink

  • Berlin, Germany
View GitHub Profile
View fish_prompt.fish
# A minimal Fish prompt based on the gitstatus prompt.
# Original gitstatus prompt from https://github.com/godfat/fish_prompt-gitstatus
# Adopted by OMF at https://github.com/oh-my-fish/theme-gitstatus
function _git_branch_name
echo (command git symbolic-ref HEAD 2> /dev/null | sed -e 's|^refs/heads/||')
end
function _git_status_symbol
set -l git_status (git status --porcelain 2> /dev/null)
View README.md

First, run sudo modprobe usbmon.

Now Wireshark should show usbmon0-N capture devices.

They correspond to USB buses (see lsusb), so select the one on which the target device is attached.

Now filter out the right device on the bus by writing a filter.

usb.src and usb.dst are the packet's source and destination address, one of which will always be "host".

@jonas-schievink
jonas-schievink / notes.md
Created Apr 29, 2020
Contributing to Rust
View notes.md

Contribution Workflows

  • Doc-only changes:

    ./x.py doc --stage=0 src/libstd

  • libstd-only changes:

    ./x.py check --stage=0 src/libstd

View rustc.basics.003-022.Nrvo.after.mir.rs
// MIR for `basics` after Nrvo
fn basics(_1: (f32,)) -> f32 {
let mut _0: f32; // return place in scope 0 at /home/jonas/dev/rust/src/test/ui/consts/const_let_eq_float.rs:11:34: 11:37
let _2: f32; // in scope 0 at /home/jonas/dev/rust/src/test/ui/consts/const_let_eq_float.rs:11:18: 11:19
let mut _4: f32; // in scope 0 at /home/jonas/dev/rust/src/test/ui/consts/const_let_eq_float.rs:14:9: 14:10
let mut _6: f32; // in scope 0 at /home/jonas/dev/rust/src/test/ui/consts/const_let_eq_float.rs:17:18: 17:19
let mut _8: f32; // in scope 0 at /home/jonas/dev/rust/src/test/ui/consts/const_let_eq_float.rs:20:22: 20:23
let mut _9: f32; // in scope 0 at /home/jonas/dev/rust/src/test/ui/consts/const_let_eq_float.rs:21:9: 21:10
scope 1 {
View dag_nrvo.rs
//! NRVO on acyclic CFGs.
use crate::transform::{MirPass, MirSource};
use rustc_middle::mir::visit::Visitor;
use rustc_middle::mir::{
read_only, Body, BodyAndCache, Constant, Local, LocalKind, Location, Operand, Place, Rvalue,
StatementKind, Statement,
};
use rustc_middle::ty::TyCtxt;
use rustc_index::vec::IndexVec;
View cargo-timing.html
<html>
<head>
<title>Cargo Build Timings — rustc-main 0.0.0</title>
<meta charset="utf-8">
<style type="text/css">
html {
font-family: sans-serif;
}
@jonas-schievink
jonas-schievink / ramfs-chroot
Created Nov 15, 2018
chroot into an initramfs with a single command
View ramfs-chroot
#!/bin/bash
set -e
if [[ $# -ne 1 ]]; then
echo "usage: ramfs-chroot <ramfs_image>"
exit 1
fi
RAMFS=$1
@jonas-schievink
jonas-schievink / main.rs
Last active Nov 30, 2018
Default log level for (pretty_)env_logger
View main.rs
extern crate env_logger;
extern crate log;
use std::env;
fn main() {
// By default, log all `info!` messages and higher, in all modules and crates.
// Can be overridden by specifying the `RUST_LOG` environment variable.
if env::var_os("RUST_LOG").is_none() {
env_logger::Builder::from_default_env()
@jonas-schievink
jonas-schievink / output-native-armv6.txt
Last active Jul 11, 2018
Passing multiple control messages at once over a Unix socket
View output-native-armv6.txt
creating socketpair
fds: 3 4
encoded cmsgs into 40 byte buf:
18 00 00 00 01 00 00 00 02 00 00 00 a7 2c 00 00 e8 03 00 00 e8 03 00 00 10 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00
re-decode msgs without going through socket:
raw control buffer size: 40 bytes
cmsg 1:
cmsg lvl: 1 (SOL_SOCKET = 1)
cmsg type: 2 (SCM_RIGHTS = 1, SCM_CREDENTIALS = 2)
cmsg len: 24 (for 1 int = 16, for ucred = 24)
@jonas-schievink
jonas-schievink / disable-power-button.patch
Last active Jun 7, 2018
pfSense patches for use with the "System Patches" package
View disable-power-button.patch
--- /etc/sysctl.conf 2018-05-27 18:31:54.209664000 +0200
+++ /etc/sysctl.conf 2018-05-27 18:53:09.071470000 +0200
@@ -1,9 +1,11 @@
# $FreeBSD$
#
# This file is read when going to multi-user and its contents piped thru
# ``sysctl'' to adjust kernel values. ``man 5 sysctl.conf'' for details.
#
+hw.acpi.power_button_state=NONE